Examples create redis server


Create redis server

/redis/utils/install_server.sh

Result:

[root@tutorialspots ~]# /redis/utils/install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/bin/redis-server]
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /usr/bin/redis-server
Cli Executable : /usr/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!

create redis server

Done, You’ll be able to stop and start Redis using the script named /etc/init.d/redis_ , for instance /etc/init.d/redis_6379

Check:

[root@tutorialspots ~]# service redis_6379 status
Redis is running (21112)

Edit file config: /etc/redis/6379.conf
To allow other server (eg: 11.11.11.11) connect to your redis server (eg:22.22.22.22)

bind 127.0.0.1 22.22.22.22
protected-mode no

Change port

port 16379

Use password

requirepass tutorialspots

Kill command CONFIG

rename-command CONFIG ""

Use iptables open port for some IP/IP CIDR

iptables -I INPUT -p udp -s 11.11.0.0/16 --dport 16379 -j ACCEPT
iptables -I INPUT -p tcp -s 11.11.0.0/16 --dport 16379 -j ACCEPT
service iptables save

1 Comment

Leave a Reply