반응형
1. Redash 란
MySQL이나 Redshift, DynamoDB 등의 다양한 종류의 데이터베이스를 연동하고, 데이터베이스에 쿼리한 결과를 바탕으로 다양한 그래프를 만들 수 있는 BI 서비스
redash : https://github.com/getredash/redash
2. Redash 설치
[설치 환경]
OS : Rocky9
docker, docker-compose 설치
1) redash 필요 패키지 설치
yum install epel-release
yum install pwgen perl-JSON-PP
2) redash 설치
- 설치 스크립트
cat setup.sh
#!/usr/bin/env bash
set -eu
REDASH_BASE_PATH=/opt/redash
create_directories() {
if [[ ! -e $REDASH_BASE_PATH ]]; then
sudo mkdir -p $REDASH_BASE_PATH
sudo chown $USER:$USER $REDASH_BASE_PATH
fi
if [[ ! -e $REDASH_BASE_PATH/postgres-data ]]; then
mkdir $REDASH_BASE_PATH/postgres-data
fi
}
create_config() {
if [[ -e $REDASH_BASE_PATH/env ]]; then
rm $REDASH_BASE_PATH/env
touch $REDASH_BASE_PATH/env
fi
COOKIE_SECRET=$(pwgen -1s 32)
SECRET_KEY=$(pwgen -1s 32)
POSTGRES_PASSWORD=$(pwgen -1s 32)
REDASH_DATABASE_URL="postgresql://postgres:${POSTGRES_PASSWORD}@postgres/postgres"
echo "PYTHONUNBUFFERED=0" >> $REDASH_BASE_PATH/env
echo "REDASH_LOG_LEVEL=INFO" >> $REDASH_BASE_PATH/env
echo "REDASH_REDIS_URL=redis://redis:6379/0" >> $REDASH_BASE_PATH/env
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $REDASH_BASE_PATH/env
echo "REDASH_COOKIE_SECRET=$COOKIE_SECRET" >> $REDASH_BASE_PATH/env
echo "REDASH_SECRET_KEY=$SECRET_KEY" >> $REDASH_BASE_PATH/env
echo "REDASH_DATABASE_URL=$REDASH_DATABASE_URL" >> $REDASH_BASE_PATH/env
}
setup_compose() {
REQUESTED_CHANNEL=stable
#LATEST_VERSION=`curl -s "https://version.redash.io/api/releases?channel=$REQUESTED_CHANNEL" | json_pp | grep "docker_image" | head -n 1 | awk 'BEGIN{FS=":"}{print $3}' | awk 'BEGIN{FS="\""}{print $1}'`
cd $REDASH_BASE_PATH
GIT_BRANCH="${REDASH_BRANCH:-master}" # Default branch/version to master if not specified in REDASH_BRANCH env var
wget https://raw.githubusercontent.com/getredash/setup/${GIT_BRANCH}/data/docker-compose.yml
sed -ri "s/image: redash\/redash:([A-Za-z0-9.-]*)/image: redash\/redash:$LATEST_VERSION/" docker-compose.yml
echo "export COMPOSE_PROJECT_NAME=redash" >> ~/.profile
echo "export COMPOSE_FILE=/opt/redash/docker-compose.yml" >> ~/.profile
export COMPOSE_PROJECT_NAME=redash
export COMPOSE_FILE=/opt/redash/docker-compose.yml
}
create_directories
create_config
setup_compose
bash setup.sh
- docker-compose 파일 실행
cd /opt/redash
cat /opt/redash/docker-compose.yml
version: "2"
x-redash-service: &redash-service
image: redash/redash:8.0.0.b32245
depends_on:
- postgres
- redis
env_file: /opt/redash/env
restart: always
services:
server:
<<: *redash-service
command: server
ports:
- "5000:5000"
environment:
REDASH_WEB_WORKERS: 4
scheduler:
<<: *redash-service
command: scheduler
environment:
QUEUES: "celery"
WORKERS_COUNT: 1
scheduled_worker:
<<: *redash-service
command: worker
environment:
QUEUES: "scheduled_queries,schemas"
WORKERS_COUNT: 1
adhoc_worker:
<<: *redash-service
command: worker
environment:
QUEUES: "queries"
WORKERS_COUNT: 2
redis:
image: redis:5.0-alpine
restart: always
postgres:
image: postgres:9.6-alpine
env_file: /opt/redash/env
volumes:
- /opt/redash/postgres-data:/var/lib/postgresql/data
restart: always
nginx:
image: redash/nginx:latest
ports:
- "80:80"
depends_on:
- server
links:
- server:redash
restart: always
docker-compose run --rm server create_db
sudo /usr/local/bin/docker-compose up -d
3) WEB 접속
http://공인 IP:5000
반응형
'MONITORING' 카테고리의 다른 글
[Thanos] Thanos 정의 (0) | 2023.07.03 |
---|---|
[Grafana] Grafana 란 (0) | 2023.06.28 |
[Prometheus] 프로메테우스란 (0) | 2023.02.14 |
[Uptime Kuma] 알림 설정 (0) | 2022.08.22 |
[Uptime Kuma] 설치 및 사용 (0) | 2022.08.19 |