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

Instance sharing of codis3.2 Cluster

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Codis3.2 cluster instances sharing, many novices are not very clear about this, in order to help you solve this problem, the following small series will explain in detail for everyone, there are people who need this to learn, I hope you can gain something.

Codis Configuration Example 3.13.10.1 Architecture Diagram and Environment

1. Structure diagram

2. Software version

(1)zookeeper-3.5.2-alpha.tar.gz

(2)go1.8.1.linux-amd64.tar.gz

(3)codis3.2

3.13.10.2 zookeeper cluster installation

1. Install jdk 1.8 (this step is not detailed)

2, Download zookeeper 3.5.2 installation

Perform the following installation on 192.168.2.122, 192.168.2.123, 192.168.2.124

(1)Prepare installation directory and data storage directory, and create id file

#Mkdir /apps/

#Mkdir -p /var/zookeeperdata/

2) Install Zookeeper

# tar -xvf zookeeper-3.5.2-alpha.tar.gz -C/apps/

(3) Configure zook.cfg

Go to/apps/zookeeper and configure zoo.cfg in the conf directory as follows:

clientPort=2181

dataDir=/var/zookeepperdata//mainly change this item.

syncLimit=5

initLimit=10

tickTime=2000

server.1=192.168.2.122:2888:3888//There must be no blank space after it, otherwise there will be an error starting.

server.2=192.168.2.123:2888:3888

server.3=192.168.2.124:2888:3888

(1)Create ID number for zookeeper server

192.168.2.122 The server executes:

Echo "1">>/var/zookeeperdata/myid

192.168.2.123 The server performs:

Echo "2">>/var/zookeeperdata/myid

192.168.2.124 The server executes:

Echo "3">>/var/zookeeperdata/myid

(5) Start and verify

./ bin/zkServer.sh start

./ bin/zkServer.sh status //View status

You can check the status: (who started first who is the leader)

192.168.2.123 as leader

192.168.2.122 and 192.168.2.124 as followers

3.13.10.3 Install codis-proxy and codis-server

Do the same on 192.168.2.122, 192.168.2.123, 192.168.9.124.

gcc gcc-c++ git autoconf

Yum -y install gcc gcc-c++ git autoconf

2. Install Go

Go to go's official website to download go.tar.gz package to/apps/directory:

#Tar -xvf go1.8.1.linux-amd64.tar.gz -C /apps/

Vi /etc/profile.d/go.sh

Export GOROOT=/apps/go

EXPORT GOPATH=apps/codis

Export PATH=$PATH:$GOROOT:$GOPATH

Source go.sh

3. Install codis

Download codis

#go get -u -d github.com/CodisLabs/codis

Codis is downloaded to/apps/codis.

(2) Compile codis

#Cd /apps/codis/src/github.com/codislabs/codis

#make

The requested URL/apps/codis/src/was not found on this servergithub.com/codislabs/codis

The following files are generated under bin/directory:

The requested URL/apps/codis/was not found on this server.

#mkdir-p /apps/codis/{bin,logs,data}/

#cp -rf$GOPATH/src/github.com/CodisLabs/codis/bin/* /opt/local/codis/bin

#cp -rf$GOPATH/src/github.com/CodisLabs/codis/config /opt/local/codis/

3.13.10.4 Start codis-dishwasher

1. Configure codis-dishwasher

Vi /apps/codis/config/ dashboard.toml

coordinator_name = "zookeeper"

coordinator_addr = "192.168.2.123:2181,192.168.2.122:2181,192.168.2.124:2181"

product_name = "codis-loready"

product_auth = ""

admin_addr = "0.0.0.0:18080"

2. Start codis-dishwasher

#./ bin/codis-dashboard --config=./ config/dashboard.toml--log=./ logs/dashboard.log --log-level=WARN &

3.13.10.5 Start codis-proxy

Start codis-proxy on 192.168.2.122, 192.168.2.123

1. Configure codis-proxy

vi proxy.toml:

product_name ="codis-loready" //key configuration

product_auth = ""

session_auth = ""

admin_addr = "0.0.0.0:11080"

proto_type = "tcp4"

proxy_addr = "0.0.0.0:19000"

jodis_name = "Zookeeper" //Key Configuration

jodis_addr = "192.168.2.123:2181,192.168.2.122:2181,192.168.2.124:2181" //Key Configuration

jodis_timeout = "20s"

jodis_compatible = false

proxy_datacenter = ""

proxy_max_clients = 1000

proxy_max_offheap_size = "1024mb"

proxy_heap_placeholder = "256mb"

backend_ping_period = "5s"

backend_number_databases = 16

2. Start codis-proxy

#./ bin/codis-proxy --config=./ config/proxy.toml --log=./ logs/proxy.log --log-level=WARN &

3.13.10.5 configure codis-server-group

Configure redis.conf on 192.168.2.123 and 192.168.2.124 and start codis-server with 192.168.2.124 as master and 192.128.2.123 as slave.

1. Configure redis.conf

192.168.2.124(master)

Vi /apps/codis/config/redis.conf

bind 127.0.0.1

bind 192.168.2.124

logfile"/apps/codis/logs/redis_6379.log"

#save 900 1 //Turn off snapshot persistence.

#save 300 10

#save 60 10000

appendonly yes //enable aof persistence

appendfilename "appendonly.aof"

appendfsync everysec

(2) 192.168.2.123(slave configuration)

Vi /apps/codis/config/redis.conf

bind 127.0.0.1

bind 192.168.2.123

logfile"/apps/codis/logs/redis_6379.log"

#save 900 1 //Turn off snapshot persistence.

#save 300 10

#save 60 10000

slaveof 192.168.2.124 6379 //Set master's address

slave-serve-stale-data yes

slave-read-only yes

appendonly yes //enable aof persistence

appendfilename "appendonly.aof"

appendfsync everysec

2. Start redis

192.168.2.123 and 192.168.2.124

Cd /apps/codis

# ./ bin/codis-server ./ config/redis.conf &

3.13.10.6 Configure CODIS-FE to manage codis

1. Generate codis.json file

./ bin/codis-admin--dashboard-list --zookeeper=192.168.2.123:2181,192.168.2.122:2181,192.168.2.124:2181|tee ./ config/codis.json

2. Start codis-fe

./ bin/codis-fe --log=./ logs/fe.log--log-level=WARN --zookeeper=192.168.2.123:2181 --listen=192.168.2.122:8089&

3. Visit 192.168.2.122:8089 to configure the cluster

(1) Add codis-proxy

Add 192.168.2.122:11080, 192.168.2.123:11080

Add codis-server-group

3) Initialize Solts

You can assign different solts to different codis-server-groups, because I only created one codis-group here, so I assign all 1024 solts to group1.

The deployment of the codis cluster is complete.

Did reading the above help you? If you still want to have further understanding of related knowledge or read more related articles, please pay attention to 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.

Share To

Servers

Wechat

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

12
Report