偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

Undermoon - 手動(dòng)設(shè)置 Redis 集群

開(kāi)發(fā) 測(cè)試
本教程將引導(dǎo)您完成手動(dòng)設(shè)置 undermoon 集群的過(guò)程,以更好地了解 undermoon 的工作原理。

本教程將引導(dǎo)您完成手動(dòng)設(shè)置 undermoon 集群的過(guò)程,以更好地了解 undermoon 的工作原理。

架構(gòu)

我們將在一臺(tái)機(jī)器上部署以下所有部件:

  • mem_broker(內(nèi)存代理)
  • coordinator(協(xié)調(diào)器)
  • 2 個(gè)代理與 4 個(gè) Redis 節(jié)點(diǎn)

構(gòu)建二進(jìn)制文件

$ cargo build

請(qǐng)注意,您還需要安裝 Redis。

部署 Memory Broker

$ RUST_LOG=undermoon=debug,mem_broker=debug UNDERMOON_ADDRESS=127.0.0.1:7799 target/debug/mem_broker

部署 Coordinator

運(yùn)行 coordinator 并指定 memory broker 地址。

$ RUST_LOG=undermoon=debug,coordinator=debug UNDERMOON_BROKER_AD

部署 Server Proxy 與 Redis

Chunk

有關(guān)詳細(xì)說(shuō)明,請(qǐng)參閱:Rust 寫(xiě)的 Undermoon Redis 集群 - Chunk。

運(yùn)行 Server Proxy 與 Redis

運(yùn)行 2 個(gè)服務(wù)器代理和 4 個(gè) Redis 節(jié)點(diǎn):

# You need to run each line in different terminals

# The first half
$ redis-server --port 7001
$ redis-server --port 7002
$ RUST_LOG=undermoon=debug,server_proxy=debug UNDERMOON_ADDRESS=127.0.0.1:6001 target/debug/server_proxy

# The second Half
$ redis-server --port 7003
$ redis-server --port 7004
$ RUST_LOG=undermoon=debug,server_proxy=debug UNDERMOON_ADDRESS=127.0.0.1:6002 target/debug/server_proxy

將 Server Proxy 和 Redis 注冊(cè)到 Memory Broker

Redis 集群永遠(yuǎn)無(wú)法在單臺(tái)機(jī)器上創(chuàng)建。即使我們有足夠的 node,Memory broker 也無(wú)法創(chuàng)建集群,因?yàn)樗鼈兯坪醵荚谕恢鳈C(jī) 127.0.0.1 中;

但是由于我們?cè)谝慌_(tái)機(jī)器上部署了整個(gè) undermoon 集群,我們需要通過(guò)在發(fā)布的 json 中將 host 字段指定為 localhost1 和 localhost2 來(lái)明確告訴 memory broker 它們?cè)诓煌闹鳈C(jī)中。

curl -XPOST -H 'Content-Type: application/json' "http://localhost:7799/api/v3/proxies/meta" -d '{"proxy_address": "127.0.0.1:6001", "nodes": ["127.0.0.1:7001", "127.0.0.1:7002"], "host": "localhost1"}'
curl -XPOST -H 'Content-Type: application/json' "http://localhost:7799/api/v3/proxies/meta" -d '{"proxy_address": "127.0.0.1:6002", "nodes": ["127.0.0.1:7003", "127.0.0.1:7004"], "host": "localhost2"}'

現(xiàn)在我們有 2 個(gè)服務(wù)器代理與 4 個(gè)節(jié)點(diǎn)。

$ curl http://localhost:7799/api/v3/proxies/addresses
{"addresses":["127.0.0.1:6001","127.0.0.1:6002"]}

$ curl http://localhost:7799/api/v3/proxies/meta/127.0.0.1:6001
{"proxy":{"address":"127.0.0.1:6001","epoch":2,"nodes":[],"free_nodes":["127.0.0.1:7001","127.0.0.1:7002"],"peers":[],"clusters_config":{}}}

$ curl http://localhost:7799/api/v3/proxies/meta/127.0.0.1:6002
{"proxy":{"address":"127.0.0.1:6002","epoch":2,"nodes":[],"free_nodes":["127.0.0.1:7003","127.0.0.1:7004"],"peers":[],"clusters_config":{}}}

創(chuàng)建集群

使用 4 個(gè) Redis 節(jié)點(diǎn)創(chuàng)建一個(gè)名為 mycluster 的集群。

$ curl -XPOST -H 'Content-Type: application/json' http://localhost:7799/api/v3/clusters/meta/mycluster -d '{"node_number": 4}'

現(xiàn)在我們可以連接到集群:

$ redis-cli -h 127.0.0.1 -p 6001 -c
127.0.0.1:6001> cluster nodes
mycluster___________2261c530e98070a6____ 127.0.0.1:6001 myself,master - 0 0 3 connected 8192-16383
mycluster___________ad095468b9deeb2d____ 127.0.0.1:6002 master - 0 0 3 connected 0-8191
127.0.0.1:6001> get a
(nil)
127.0.0.1:6001> get b
-> Redirected to slot [3300] located at 127.0.0.1:6002
"1"


責(zé)任編輯:武曉燕 來(lái)源: 黑客下午茶
相關(guān)推薦

2022-01-26 20:43:04

集群構(gòu)建塊Chunk

2022-01-27 20:15:31

集群存儲(chǔ)元數(shù)據(jù)

2022-01-26 00:06:08

Redis分布式客戶端

2022-02-06 21:14:57

Redis命令

2021-01-15 08:07:30

Ceph octopu集群運(yùn)維

2017-03-31 14:25:19

手動(dòng)docker swar集群

2021-07-06 07:46:16

KubernetesRook存儲(chǔ)

2024-03-07 16:03:56

RedisDocker

2024-11-04 15:49:43

Redis?數(shù)據(jù)遷移

2021-01-07 10:18:03

Redis數(shù)據(jù)庫(kù)環(huán)境搭建

2010-04-14 17:11:13

Oracle管理

2010-02-22 17:33:55

CentOS vmwa

2020-09-23 07:39:59

SpringBoot項(xiàng)目Redis

2019-10-23 09:20:11

Redis集群主從復(fù)制

2023-09-27 06:26:07

2023-09-26 01:07:34

2022-03-31 19:20:39

集群PostgreSQLCitus

2025-04-29 01:30:00

Redis集群節(jié)點(diǎn)

2017-10-16 10:06:21

Windows 10Windows更新補(bǔ)丁

2025-02-24 10:07:09

Redis節(jié)點(diǎn)遷移集群
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)