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 realize the Redis Cluster Scheme

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to realize the Redis cluster scheme". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "how to implement the Redis cluster scheme"!

1. Codis solution of Redis

1. Codis on the open source of pea pods

Codis is a Redis distributed cluster solution developed by Pea using Go and C language and implemented as an agent, and is fully compatible with Twemproxy. For the upper-tier application, there is no obvious difference between connecting to Codis Proxy (Redis proxy service) and connecting to the native Redis server, and the upper-tier application can be treated like a stand-alone Redis. The bottom layer of Codis will handle the forwarding of requests, non-stop data migration and other work, and all the underlying processing is transparent to the client. In short, you can simply think that the background connection is a Redis service with unlimited memory. Codis is released under the MIT open source agreement. For more information about Codis, please visit its home page at GitHub.

Codis is a distributed Redis solution. For upper layer applications, there is no obvious difference between connecting to Codis Proxy and connecting native Redis Server (unsupported command list). The upper application can be used like a stand-alone Redis. The bottom layer of Codis will handle request forwarding, non-stop data migration and other work. Everything behind is transparent to the front client. It can be simply thought that what is connected behind is a Redis service with unlimited memory.

Codis consists of four parts:

Codis Proxy (codis-proxy)

Codis Manager (codis-config)

Codis Redis (codis-server)

ZooKeeper

Architecture diagram:

2. Install the go language environment

Yum install mercurial

Yum install git

Yum install gcc

Then you can download the golang package.

Download version 1.4 zip package: https://github.com/golang/go/tree/release-branch.go1.4

Or: git clone https://github.com/golang/go.git-b release-branch.go1.4

Unzip go-release-branch.go1.4.zip

Cd / root/go-release-branch.go1.4/src

. / all.bash

Then we're going to add environment variables.

Vi / etc/profile

Then we refresh the environment variables

Source / etc/profile

Go get github.com/tools/godep (after the get is finished, it is downloaded to the GOPATH/src)

Go install github.com/tools/godep (when the install is finished, the godep command is downloaded to GOPATH/bin)

Zookeeper build:

. / zookeeper-3.4.6/bin/zkServer.sh start

Vim config.ini

/ usr/local/codis/src/github.com/wandoulabs/codis/bin/codis-config-c / usr/local/codis/src/github.com/wandoulabs/codis/config.ini server add 1 172.31.2.14 master

/ usr/local/codis/src/github.com/wandoulabs/codis/bin/codis-config-c / usr/local/codis/src/github.com/wandoulabs/codis/config.ini slot init

Use the make menuconfig-- debug-w-- just-print command to debug without performing an operation

/ usr/local/codis/src/github.com/wandoulabs/codis/bin/codis-proxy-c / usr/local/codis/src/github.com/wandoulabs/codis/config.ini-L / data/log/codis-proxy_1.log-- cpu=4-- addr=0.0.0.0:19000-- http-addr=0.0.0.0:11000

At this point, I believe you have a deeper understanding of "how to implement the Redis cluster scheme". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report