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-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Ubuntu how to install redis cluster, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

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.

4. 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

5. View the service

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.1VL 7000 127.0.0.1V 7001 127.0.1V 7002 127.0.0.1V 7003 127.0.1V 7003 127.0.1V 7004 127.0.1V 7005

Problems that may be encountered

Just log in to each node with redis-cli and execute flushall and cluster reset. two。 Log in to redis:redis-cli-h 127.0.0.1-p 63793. View all key values: keys * 4. Delete the value of the specified index: del key5. Clear the data from the entire Redis server: flushall 6. Clear all key:flushdb in the current library

Set server password

Redic-cli-a 123456

Requirepass 123456 in the configuration file

Redis-cli-h 127.0.0.1-c-p 7002

Config set masterath 123456 config set requirepass 123456

Three Cluster modes of redis

Redis cluster building (very detailed, suitable for beginners)

Redis 3.2.1 Cluster Building

Detailed explanation of installation, deployment and use of Redis Cluster under Linux

Ubuntu install Redis

Ubuntu redis cluster configuration

Redis cluster configuration of ubuntu

Building Redis clusters under the Ubuntu of Redis

. / redis-trib.rb error: / usr/local/rvm/gems/ruby-2.4.2/gems/redis-4.0.1/lib/redis/client.rb:119:in `call': ERR Slot 0 is already busy (Redis::CommandError)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report