#复制两份redis.conf,分别是6378、6379的配置文件 cp redis.conf redis-6378.conf cp redis.conf redis-6379.conf#端口默认是6379,所以将redis-6378.conf的端口修改为6378,并将两个配置文件的bind 127.0.0.1 改为0.0.0.0(所有地址都能访问,如不改则只有本机可访问)vim /usr/local/soft/redis/redis-4.0.11/redis-6378.conf
vim /etc/init.d/redis-6379
文本内添加:
#!/bin/bash # description: redis Start Stop Restart # processname: redis # chkconfig: 234 30 90 REDIS_HOME=/usr/local/soft/redis case $1 in start) $REDIS_HOME/redis-4.0.11/src/redis-server $REDIS_HOME/redis-4.0.11/redis-6379.conf & ;; stop) kill -9 `lsof -i:6379 | awk '{print $2}'` echo "redis-6379 killed" ;; restart) service redis-6379 stop sleep 0.2m service redis-6379 start ;; esac exit 0
6378同理:
service redis-6379 start
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition.
To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf
and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.15104:M 10 Apr 09:44:29.767 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel.
This will create latency and memory usage issues with Redis.
To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local
in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
15104:M 10 Apr 09:44:29.767 * Ready to accept connections
vim /etc/sysctl.conf
文本内加:
vm.overcommit_memory = 1
使之生效
sysctl vm.overcommit_memory=1
echo never > /sys/kernel/mm/transparent_hugepage/enabled
添加到文件使开机重启后继续生效
vi /etc/rc.local
文本内添加:
echo never > /sys/kernel/mm/transparent_hugepage/enabled
#启动6379service redis-6379 start #启动6378 service redis-6378 start #查看进程ps -ef | grep redis
文本中添加
export REDIS_HOME=/usr/local/soft/redis/redis-4.0.1 :$REDIS_HOME/src
使之生效
source /etc/profile测试是否配置成功
redis-cli
可以使所有的ip访问redis,若是想指定多个ip访问,但并不是全部的ip访问,可以bind
vim /usr/local/soft/redis/redis-4.0.11/redis-6379.conf
转载于:https://www.cnblogs.com/yybrhr/p/10688098.html
相关资源:DirectX修复工具V4.0增强版