-
Notifications
You must be signed in to change notification settings - Fork 1
Example Redis Setup (Ubuntu)
Angel Sanadinov edited this page Apr 7, 2017
·
4 revisions
These are example steps for setting up a Redis instance on Ubuntu. They will create a user redis, download version 3.2.5, install it under /opt/redis and add config under /opt/redis/<org>.
<org>should be replaced with some identifier (your organization, user, etc).
useradd -d /home/redis -m redis
mkdir -p /opt/redis/<org>/data
cd /opt/redis
wget http://download.redis.io/releases/redis-3.2.5.tar.gz
tar -xzf redis-3.2.5.tar.gz
cd redis-3.2.5
make
make test
make PREFIX=/opt/redis install
# ... add service script ...
touch /opt/redis/<org>/com-<org>-redis.sh
# ... add Redis config ...
touch /opt/redis/<org>/core.conf
chown -R redis.redis /opt/redis
sudo chmod 700 /opt/redis/<org>/com-<org>-redis.sh
sudo ln -s /opt/redis/<org>/com-<org>-redis.sh /etc/init.d/com-<org>-redis
sudo update-rc.d com-<org>-redis defaults 97 03
- Ubuntu 16.04
- Redis 3.2.5
Replace <org> with your organization name (or something else)
#! /bin/sh
### BEGIN INIT INFO
# Provides: com-<org>-redis
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: redis
# Description: This file starts and stops a single Redis instance
### END INIT INFO
case "$1" in
start)
su redis -c "/opt/redis/bin/redis-server /opt/redis/<org>/core.conf"
;;
stop)
su redis -c "kill $(head -1 /opt/redis/redis.pid)"
;;
restart)
su redis -c "kill $(head -1 /opt/redis/redis.pid)"
sleep 5
su redis -c "/opt/redis/bin/redis-server /opt/redis/<org>/core.conf"
;;
status)
1
;;
*)
echo "Usage: com-<org>-redis.sh {start|stop|restart}" >&2
exit 3
;;
esacHome | Getting Started | Structure | Containers | Workflows | Controllers