Build a redis cluster in centos and a centosredis Cluster

Source: Internet
Author: User
Tags redis cluster

Build a redis cluster in centos and a centosredis Cluster
Essential tools: redis-3.0.0.tarredis-3.0.0.gem (ruby and redis Interface) Analysis: first, the number of clusters requires a base, here to build a simple redis cluster (six redis instances for the cluster ). To operate on a server, you only need six different port numbers. They are: 7001, 7002, 7003, 7004, 7005. Step: 1. Upload redis-3.0.tarto the server (, decompress redis-3.0.0.tar. 2. Install the C language environment (after centos is installed, it comes with the C language environment) yuminstallgcc-c ++ 3, go to the redis-3.0.0 directory make4, install redis to the/usr/local/redis directory makeinstallPREFIX =/usr/local/redis5, check whether the installation is successful (the bin directory appears) 6. Start redis on the front end (enter the bin directory ). /redis-server (Enabled ). /redis-clishutdown7, back-end boot need to redis unzipping the source package (under the redis-3.0.0 directory) redis. copy the conf file to the bin directory and modify redis. conf file, change daemonize to yes first use vimredis. run the conf command to start the redisbin directory at the backend. /redis-serverredis.conf to check whether the boot is successful to close the way back-end boot: The above is a separate redis installation, then build the Cluster! Install rubyyuminstallrubyyuminstallrubygems upload the following files to the linux system and go to the directory for execution: The geminstallredis-3.0.0.gem copies the following files from the src directory under the redis-3.0.0 package to/usr/local/redis-cluster/prerequisites: creating a New redis-cluster directory requires at least three hosts to build a cluster. If each host is configured with another slave, at least six machines are required. The port design is as follows: Step 1: Copy A 7001 machine and run cpbin in the/usr/local/redis/directory. /redis-cluster/7001-r Step 2: If a persistent file exists, delete the rm-rfappendonly.aofdump.rdb Step 3: Set the cluster Parameters Step 4: Modify the port Step 5: copy the 7002-7006 host to show the directory structure under my desktop system: Next, set up one-click to start all redis or close the redis group: first, create a file and use vim to open a non-existent file, and then save it. (Start-all.sh and shutdow-all.sh is my new) start-all.sh: cd7001./redis-serverredis.confcd .. cd7002./redis-serverredis.confcd .. cd7003./redis-serverredis.confcd .. cd7004./redis-serverredis.confcd .. cd7005./redis-serverredis.confcd .. cd7006./redis-serverredis.confcd .. shutdow-all.sh: cd7001./redis-cli-p7001shutdowncd .. cd7002./redis-cli-p7002shutdowncd .. cd7003./redis-cli-p7003shutdowncd .. cd7004../redis-cli-p7004shutd Owncd .. cd7005./redis-cli-p7005shutdowncd .. cd7006./redis-cli-p7006shutdowncd .. next modify the two file permissions, set it to the script file that can be started chmodu + xstart-all.shchmodu + xshutdown-all.sh next connect to these clusters with ruby for management/redis-trib.rbcreate -- replicas119%78.%: 700119%78.%: 7002192.168.78.%: 7003192.168.78.%: 7004192.168.78.20.: 7005192.168.78.20.: 7006 connectingtonode192.168.242.0000: 7001: okconnectingtonode192.168.242.0000: 7002: OKConnectin Gtonode192.168.242.0000: 7003: okconnectingtonode192.168.242.0000: 7004: okconnectingtonode192.168.242.0000: 7005: okconnectingtonode192.168.242.0000: 7006: OK >>> define minghashslotsallocationon6nodes... using3masters: 192.168.242.ters: 700119425242.ters: 7002192.168.242.137: 7003Addingreplica192. 168.242.8.0: 7004to192. 168.242.20.: 7001Addingreplica192. 168.242.8.0: 7005to192. 168.242.8.0: 7002Addingreplica192. 168.242.1 37: 7006to192. 168.242.8.0: 7003 M: 1160cd0fe6d6f842faa42b0174fe7c5ddcf7ae24192. 168.242.133: 7001 slots: 0-5460 (5461 slots) masterM: 4f52a974f64343fd9f1ee0388490b3c0647a4db7192. 168.242.133: 7002 slots: 5461-10922 (5462 slots) masterM: Weight: 7003 slots: 10923-16383 (5461 slots) masterS: 66adf006fed43b3b5e499ce2ff1949a756504a16192. 168.242.20.: 7004replicates%0cd0fe6d6f842f Aa42b0174fe7c5ddcf7ae24S: pushed: a908736eadd1cd06e86fdff8b2749a6f46b38c00192.168.242.133: pushed? (Type 'yes' toaccept): yes >>> Nodesconfigurationupdated >>> Assignadifferentconfigepochtoeachnode >>>> SendingCLUSTERMEETmessagestojointheclusterWaitingfortheclustertojoin...> performingClusterCheck (usingnode192.168.242.137: 7001) M: 1270cd0fe6d6f842faa42b0174fe7c5ddcf7ae24192. 168.242.133: 7001 slots: 0-5460 (5461 slots) masterM: 4f52a974f64343fd9f1ee0388490b3c0647a4db7192. 168.242.small: 7002 slots: 5461-10922 (5462 slots) m AsterM: increment: 7003 slots: 10923-16383 (5461 slots) masterM: Increment. 168.242.gradient: 7004 slots :( 0 slots) increment: 7005 slots :( 0 slots) increment: a908736eadd1cd06e86fdff8b2749a6f4 6b38c00192. 168.242.137: 7006 slots :( 0 slots) fail [OK] fail.> Checkforopenslots...> Checkslotscoverage... [OK] All16384slotscovered! Test, go to the 7001 directory and execute:./redis-cli-h192.168.242.137-p7001-c

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.