-
-
Save hatamiarash7/7319c4c22295ee59590a3f55c3c3e241 to your computer and use it in GitHub Desktop.
Install redis on CentOS 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/ | |
# --- Compiling --- | |
$ yum install gcc make tcl | |
$ REDIS_VER=3.2.3 | |
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz | |
$ tar xzvf redis-$REDIS_VER.tar.gz | |
$ cd redis-$REDIS_VER | |
$ make | |
$ make test | |
$ make install | |
// --- Installing --- | |
$ cd src | |
$ mkdir /etc/redis | |
$ mkdir -p /var/lib/redis/6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set the vm.overcommit_memory to 1, which means always, this will avoid data to be truncated | |
$ sudo nano /etc/sysctl.conf | |
vm.overcommit_memory=1 | |
$ sysctl vm.overcommit_memory=1 | |
# Change the maximum of backlog connections some value higher than the value on tcp-backlog option of redis.conf, which defaults to 511 | |
$ sysctl -w net.core.somaxconn=512 | |
# Disable transparent huge pages support, that is known to cause latency and memory access issues with Redis. | |
$ echo never > /sys/kernel/mm/transparent_hugepage/enabled | |
$ sysctl -w fs.file-max=100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy sample redis.conf to /etc/redis/6379.conf. | |
$ cp redis.conf /etc/redis/6379.conf | |
# Set daemonize to no, systemd need it to be in foreground, otherwise Redis will suddenly die. | |
daemonize no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See: http://linoxide.com/storage/install-redis-server-centos-7/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy sample init_script to /etc/init.d, note also the number of the port on the script name | |
$ cp utils/redis_init_script /etc/init.d/redis_6379 | |
# edit new file /etc/systemd/system/redis_6379.service with the following content | |
[Unit] | |
Description=Redis on port 6379 | |
[Service] | |
Type=forking | |
ExecStart=/etc/init.d/redis_6379 start | |
ExecStop=/etc/init.d/redis_6379 stop | |
[Install] | |
WantedBy=multi-user.target | |
$ systemctl enable redis_6379.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ chkconfig --add redis | |
$ chkconfig --level 345 redis on | |
$ service redis start/stop/restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment