In this step-by-step guide, we will install and configure Redash on CentOS 6. Redash is an open source software which is used to query, visualize and share data. It can be connected to a number of sources (e.g. MySQL, PostgreSQL, MongoDB etc.) to collect data.
Redash helps you to make your company data driven. Using it, dashboard and charts can be created easily and shared across team. This helps to develop a culture inside company which depends on metrics and analytics. The catch here is not to analyse data ‘for sake of it’ and choose the right metrics for analysis.
In God We Trust, All Others Bring Data – W. Edwards Deming
Redash provides a provisioning script for Ubuntu 16.04. They also provide images for AWS, Google Compute Cloud and Docker. But, they have discontinued Amazon Linux AMI support and no provisioning scripts are available for CentOS. If you are running a production environment, it is often advisable to get along with the platform supported by redash.
Since we too _like to live dangerously, in this tutorial we will install redash on a newly created CentOS instance. _
Do you pine for the days when men were men and wrote their own device drivers? – Linus Torvalds
Why to install on CentOS 6 when it’s not a supported platform?
Ian: Your scientists were so preoccupied with whether or not they could, they didn’t stop to think if they should. – Jurassic Park
sudo yum install -y tcl
cd /tmp/
wget http://download.redis.io/releases/redis-3.2.6.tar.gz
tar xzf redis-3.2.6.tar.gz
cd redis-3.2.6
make
make test
sudo make install
Execute install script to generate redis config file, /etc/init.d script, install them and run redis server.
Set overcommit_memory to 1 (always overcommit, never check)
1
2
3
4
5
6
7
8
sudo sysctl vm.overcommit_memory=1# to make the change permanent# open sysctl.conf for editing
sudo vim /etc/sysctl.conf
# add below line
vm.overcommit_memory=1
Redis guidances on why vm.overcommit_memory should be set to 1.
# set variables for current shellFILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/v4.0.0/setup/ubuntu/files
# download config file
sudo wget -O /etc/supervisor/conf.d/redash.conf "$FILES_BASE_URL/supervisord.conf"
change path for gunicorn and celery to /opt/redash/current/venv/bin/gunicorn and /opt/redash/current/venv/bin/celery (3 places) in /etc/supervisor/conf.d/redash.conf
# stop supervisor if already running
sudo supervisorctl shutdown
# start supervisor with new config
sudo supervisord -c /etc/supervisord.conf
# checking status
sudo supervisorctl status
# remove default nginx config file
sudo rm /etc/nginx/conf.d/default.conf
# set variables for current shellFILES_BASE_URL=https://raw.githubusercontent.com/getredash/redash/v4.0.0/setup/ubuntu/files
# run below command to download config file from redash server
sudo wget -O /etc/nginx/conf.d/redash.conf "$FILES_BASE_URL/nginx_redash_site"# restart nginx
sudo service nginx restart
# access site# we will build frontend code in step 13
http://localhost/
if you see 502 Bad Gateway erorr on accessing website, check error logs: /var/log/nginx/error.log
# set variables for current shell# update REDASH_VERSION to latest that needs to be installed# set variables for current shellREDASH_BASE_PATH=/opt/redash
REDASH_VERSION=8.0.0
LATEST_URL=https://github.com/getredash/redash/archive/v${REDASH_VERSION}.tar.gz
VERSION_DIR=$REDASH_BASE_PATH/redash.${REDASH_VERSION}REDASH_TARBALL=/tmp/redash.tar.gz
# run below commands for extracting redash source
sudo -u redash wget "$LATEST_URL" -O "$REDASH_TARBALL"
sudo -u redash tar -C "$REDASH_BASE_PATH" -xvf "$REDASH_TARBALL"
sudo -u redash mv ${REDASH_BASE_PATH}/redash-* ${VERSION_DIR}
Below is the docker container used for testing above scripts. Make sure that the allocated RAM to docker is more than 5GB (Docker > Preferences > Resouces - Memory). Otherwise the container will be limited to the max docker RAM size.
1
docker run -t -d --memory="5g" --name redash -p 80:80 centos:6.8