Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install redis Cluster in ubuntu

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to install redis cluster in ubuntu, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

First check to see if gcc is installed

Gcc-v

If gcc is not installed, you need to install it

# if centosyum install gcc-c++#ubuntusudo apt-get install gcc# is not installed, there will be problems with sudo apt install make

download

Wget http://download.redis.io/releases/redis-3.2.1.tar.gztar-zxvf redis-3.2.1.tar.gz cd redis-3.2.1 make make install PREFIX=/usr/local/redis

The creation of cluster

Cd / usr/local/ mkdir redis_cluster/ / create a cluster directory mkdir 7000 7001 7002 / / each represents three nodes and their corresponding ports 7000 7001 7002 cp / usr/local/redis-3.2.1/redis.conf. / redis_cluster/7000/ copy to 7001 directory cp / usr/local/redis-3.2.1/redis.conf. / redis_cluster/7001/ copy to 7002 directory cp / usr/local/redis-3.2.1/redis.conf. / redis_cluster/7002/ sudo cp-r redis/bin/ redis_cluster/7000/ sudo cp-r redis/bin/ redis_cluster/7001/ sudo cp-r redis/bin/ redis_cluster/7002/

Modify the corresponding configuration for the three files in the 7001pd7002 and 7003 folders respectively

Daemonize yes / / redis background runs pidfile / var/run/redis_7000.pid / / pidfile file corresponding to 7000Magne7002Magne7003port 7000 / / Port 7000Magne7002Power7003clusterlyenabled yes / / enable cluster to open the cluster and comment # remove the configuration of cluster-config-file nodes_7000.conf / / cluster For the first time, the file starts to automatically generate 7000Magne7001Magne7002clustercolor color color timeout 5000 / / request timeout set 5 seconds enough for appendonly yes / / aof log to be enabled if necessary It records a log for each write operation.

Create 3 nodes in 192.168.1.238: the corresponding port is changed to 7003 7004 7005. Just change the corresponding configuration.

Two machines start each node (two servers in the same way)

Cd / usr/localredis-server redis_cluster/7000/redis.confredis-server redis_cluster/7001/redis.confredis-server redis_cluster/7002/redis.confredis-server redis_cluster/7003/redis.confredis-server redis_cluster/7004/redis.confredis-server redis_cluster/7005/redis.conf

View Servic

Ps-ef | grep redis # check whether netstat-tnlp is started successfully | grep redis # can see the redis listening port

The cluster must have 6 nodes

Sudo apt-get install ruby sudo apt-get install rubygems sudo gem install redis./redis-trib.rb create-- replicas 1 127.0.0.1 ubuntu 7000 127.0.0.1 ubuntu 7002 127.0.1 7003 127.0.1 7003 127.0.1 thank you for reading this article carefully. I hope it will be helpful for the editor to share how to install the redis cluster in ubuntu. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you have any problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report