In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to build Redis 6.x Sentinel Sentinel Cluster, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.
Brother Ma takes you through the tutorial of installing Redis 6.x in CentOS 7. Before we can learn Redis, we need to build a sentinel environment. The machine is limited, and the goal is to build six nodes on one machine to form an one-master, two-slave, three-sentry cluster mode.
Download and decompress
You can download the latest stability package directly from Redis's official website at https://redis.io/download. Or use the command: sudo wget http://download.redis.io/releases/redis-6.0.9.tar.gz to download the installation package..
Brother Ma put the software package in the / opt/soft directory and created the directory mkdir redisSentinel. Execute the mkdir 6479 6480 6481 26379 26380 26381 6479 6480 6481 redis.conf configuration template corresponding to the Redis master-slave node under the redisSentinel directory.
Tar-zxf redis-6.0.9.tar.gz-C redisSentinel unzipped to the redisSentinel directory.
Make compilation
We need to confirm the gcc version before compiling. Since redis 6.0.0, compiling redis needs to support the C11 feature, which was introduced in 4.9. The default gcc version of Centos 7 is 4.8.5, so you need to upgrade the gcc version.
Otherwise, an error will be reported during compilation.
Solution yum-y install gcc gcc-c++ make tcl yum-y install centos-release-scl yum-y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils scl enable devtoolset-9 bash
The make error problem can be resolved after the upgrade.
Note: the scl command is enabled only temporarily. Exiting xshell or restarting will revert to the original gcc version. If you want to be effective for a long time, execute sudo echo "source / opt/rh/devtoolset-9/enable" > > / etc/profile.
Cd / opt/soft/redisSentinel/redis-6.0.9 changes to the directory to execute make.
After compilation, use make install to install redis, command: sudo make install.
Master-slave replication
Copy three copies of redis.conf to the 6479 6480 6481 directory and modify the configuration:
Master# master port port 6479 # enables Redis to access bind 172.16.90.152 # background execution of daemonize yes pidfile / var/run/redis_6479.pidslave
It is mainly because the port numbers are different, which are 6480 and 6481 respectively, and replicaof 172.16.90.152 6479 is added at the end.
# master port port 6480 # enables Redis to access bind 172.16.90.152 # background executes daemonize yes # specify masterip master port replicaof 172.16.90.152 6479 to launch Redis respectively
Start the master-slave node through redis-server.
. / redis-6.0.9/src/redis-server redis-6479/redis.conf. / redis-6.0.9/src/redis-server redis-6480/redis.conf. / redis-6.0.9/src/redis-server redis-6481/redis.conf check cluster status. / redis-6.0.9/src/redis-cli-p 6479 info Replication configure Sentinel Cluster
Copy the Sentinel configuration file to sentinel26380 sentinel26381 sentinel26382 separately, note that the port configuration of each file and the last number 2 in sentinel monitor mymaster 172.16.90.152 6479 2, the summary of the Sentinel cluster must be consistent with each node.
Modify each of these three configuration files:
# bind IP bind 0.0.0.0 # run daemonize yes # default yes in the background. If no password or IP is specified, the public network cannot access the port of protected-mode no # Sentinel. The client uses this port to find that redis port 26380 # this file will be generated automatically (if launched on the same server Note that it should be modified to a different port) the name of the master monitored by pidfile / var/run/redis-sentinel-26380.pid # sentinel is mymaster, and the initial address is 127.0.0.1 6380, which means that two or more sentinels are considered dead. Sentinel monitor mymaster 172.16.90.152 6479 2 starts the Sentinel cluster. / redis-6.0.9/src/redis-sentinel sentinel26380/sentinel.conf. / redis-6.0.9/src/redis-sentinel sentinel26381/sentinel.conf. / redis-6.0.9/src/redis-sentinel sentinel26382/sentinel.conf
View the master-slave information monitored by sentinel:
Redis-cli-h 192.168.31.220-p 26380 sentinel master mymaster SENTINEL replicas mymaster SENTINEL sentinels mymaster Test automatic failover redis-cli-p 6480 DEBUG sleep 30
Check the current master address again and this time you will get a different response:
Is it helpful for SENTINEL get-master-addr-by-name mymaster 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.