Linux set up Redis Cluster (not impossible to do something)

Under Linux cluster built redis

1, copy the configuration file

Under Linux, configure Redis cluster, first of all is to copy several configuration files, you have to a few to several (at least three), I am here to three

cp redis.conf redis_6379.conf
cp redis.conf redis_6380.conf
cp redis.conf redis_6381.conf

2, modify the configuration file

We just want Redis server via a different profile to start, so as to achieve more Redis service

Now let's just modify the configuration file, the following main changes

port 6379
# Redis服务器的端口号

pidfile /var/run/redis_6379.pid
# Redis的进程名

logfile "6379.log"
# 日志记录

dbfilename dump_6379.rdb
# 备份的文件名

3, start Redis cluster

After modifying the configuration files, we will start the Redis server, enter the following command

/usr/local/bin/redis-server /root/java/redis/employ/redis_6379.conf
/usr/local/bin/redis-server /root/java/redis/employ/redis_6380.conf
/usr/local/bin/redis-server /root/java/redis/employ/redis_6381.conf

// 前面是Redis的服务,后面是配置文件的位置

After you start to see if the process is running

ps -ef|grep redis

4, the relationship between the primary and

Open Client Redis, and connect through a different port number, I use a different window display

Then you need to set the machine to enter the window, you can let go from slave to master copy of the above

SLAVEOF 127.0.0.1 6379

 

Published 36 original articles · won praise 3 · Views 5658

Guess you like

Origin blog.csdn.net/TanGuozheng_Java/article/details/104085101