Linux Next server Redis master-slave Replication (master-slave) configuration

Source: Internet
Author: User

Master-Slave concept
    • A master can have multiple slave, a slave? can have multiple slave, so go on, form a strong? Multi-level server cluster architecture
    • Master used to write data, slave used to read data, statistics: the website read and write ratio is 10:1
    • Read/write separation via master/slave configuration

    • Master-Slave configuration configuration
    • View the IP address of the current host

Ifconfig

    • Modify the Etc/redis/redis.conf file

sudo vim redis.conf
Bind 192.168.26.128

    • Restart Redis Service

sudo service Redis stop
Redis-server redis.conf

    • Configuration from
      • Copy the etc/redis/redis.conf file

        sudo cp redis.conf./slave.conf

      • Modify the Redis/slave.conf file

        sudo vi slave.conf

      • Edit Content

        Bind 192.168.26.128
        Slaveof 192.168.26.128 6379
        Port 6378

      • Redis Service

        sudo redis-server slave.conf

      • View Master-Slave relationships

        Redis-cli-h 192.168.26.128 Info Replication

Data manipulation
    • In master and slave, separate the? Info command to view the output information into the master client

      Redis-cli-h 192.168.26.128-p 6379

    • Go to the client from

      Redis-cli-h 192.168.26.128-p 6378

    • Write Data on Master

      Set AA AA

    • Read the data on the slave

      Get AA

Linux Next server Redis master-slave Replication (master-slave) configuration

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.