In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Redis Cluster: (1) edis is an open source key value storage system, favored by the majority of Internet companies. Before version 3.0, redis only supports single-case mode, and clusters are only supported in version 3.0 and later. Here, I use the latest version redis-5.0.7;(2) redis clusters adopt P2P mode, which is completely decentralized, and there is no central node or proxy node;(3) Redis cluster does not have a unified entrance. When the client connects to the cluster, it can connect any node in the cluster. The nodes in the cluster communicate with each other (PING-PONG mechanism). Each node is a redis instance. Second, the environment required for cluster construction: (1) Redis cluster needs at least 3 nodes, because the voting fault tolerance mechanism requires more than half of the nodes to think that a node is hung, so 2 nodes cannot form a cluster. (2) To ensure the high availability of the cluster, each node needs to have a slave node, that is, a backup node, so the Redis cluster needs at least 6 servers. (3) Install Ruby III. Deploy clusters: In order to save resources, two virtual machines are prepared here, each with three network cards installed, so that there are six network cards in total, that is, six redis instances running at the same time. Role IP address redis1 192.168.220.131redis2 192.168.220.164redis3 192.168.220.165redis4 192.168.220.135redis5 192.168.220.166redis6 192.168.220.167 Step 1: Install redis service first Step 2: Modify the configuration file, all nodes are configured the same vim /etc/redis/6379.conf1. First, comment out the bind item: bind option in//redis listens to all network cards by default. 2. Do the following: protected-mode no //Close protection mode port 6379 //open listening port daemonize yes //cluster-enabled yes //Enable clustering cluster-config-file nodes-6379.conf //cluster name file location cluster-node-timeout 15000 //cluster timeout setting appendonly yes //open aof persistence (1) Restart the service: /etc/init.d/redis_6379 restart (2) After the restart, two files will appear in the directory/var/lib/redis/6379: appendonly.aof: persistent file nodes-6379.conf: configuration file generated by the node for the first time
Step 3: This step only needs to operate in the master server. 1. Import the key file: gpg --keyserver hkp://keys.gnupg.net--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E32. Install rvm: curl -sSL https://get.rvm.io|bash -s stable13, Executing environment variables: source /etc/profile.d/rvm.shrvm list known //List Ruby installable versions 4, Install Ruby 2.4.1 version rvm install 2.4.15, Use Ruby 2.4.1 version rvm use 2.4.1ruby -v //View current Ruby 2.4.1 version
6. Install Redisgem install redis again
7. Restart redis/etc/init.d/redis_6379 restart Step 4: Create the cluster Six instances are divided into three groups, one master and one slave in each group. -replicas 1 means one slave in each group. When interacting below, you need to enter yes to create. Create clusters using the redis-trib.rb tool in the source extraction directory. redis-cli --cluster create 192.168.220.131:6379 192.168.220.164:6379 192.168.220.165:6379 192.168.220.135:6379 192.168.220.166:6379 192.168.220.167:6379 --cluster-replicas 1
Step 5: Verification: (1) Log in to a redis at random and create a pair of key values: redis-cli -h 192.168.220.164-p 6379 //connect to 164 this host
(2) At this point, we connect to log in to another host, check the key name: redis-cli -h 192.168.220.131-p 6379 //connect to host 131
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.