-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc] Add redis-cluster help document #2073
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
### Pre-monitoring operations | ||
|
||
1. create a empty folder and add two files. | ||
|
||
*redis.config* | ||
|
||
``` | ||
port 6379 | ||
cluster-enabled yes | ||
cluster-config-file nodes.conf | ||
cluster-node-timeout 5000 | ||
appendonly yes | ||
bind 0.0.0.0 | ||
protected-mode no | ||
|
||
``` | ||
|
||
*docker-compose.yml* | ||
|
||
```yml | ||
services: | ||
redis-master-1: | ||
image: redis:latest | ||
container_name: redis-master-1 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "1000:6379" | ||
|
||
redis-master-2: | ||
image: redis:latest | ||
container_name: redis-master-2 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "2000:6379" | ||
|
||
redis-master-3: | ||
image: redis:latest | ||
container_name: redis-master-3 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "3000:6379" | ||
|
||
redis-slave-1: | ||
image: redis:latest | ||
container_name: redis-slave-1 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "1001:6379" | ||
|
||
redis-slave-2: | ||
image: redis:latest | ||
container_name: redis-slave-2 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "2001:6379" | ||
|
||
redis-slave-3: | ||
image: redis:latest | ||
container_name: redis-slave-3 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "3001:6379" | ||
|
||
networks: | ||
default: | ||
external: | ||
name: hertzbeat-redis-cluster | ||
``` | ||
|
||
2. View the IP addresses of all containers from the network, which is required when building a cluster. | ||
|
||
```bash | ||
docker-compose up -d | ||
docker network inspect hertzbeat-redis-cluste | ||
``` | ||
|
||
``` | ||
"Containers": { | ||
"187b879f73c473b3cbb82ff95f668e65af46115ddaa27f3ff1a712332b981531": { | ||
... | ||
"Name": "redis-slave-2", | ||
"IPv4Address": "192.168.117.6/24", | ||
... | ||
}, | ||
"45e22b64c82e51857fc104436cdd6cc0c5776ad10a2e4b9d8e52e36cfb87217e": { | ||
... | ||
"Name": "redis-master-3", | ||
"IPv4Address": "192.168.117.3/24 | ||
... | ||
}, | ||
"57838ae37956f8af181f9a131eb011efec332b9ed3d49480f59d8962ececf288": { | ||
... | ||
"Name": "redis-master-2", | ||
"IPv4Address": "192.168.117.7/24", | ||
... | ||
}, | ||
"94478d14bd950bcde533134870beb89b392515843027a0595af56dd1e3305a76": { | ||
... | ||
"Name": "redis-master-1", | ||
"IPv4Address": "192.168.117.4/24", | ||
... | ||
}, | ||
"ad055720747e7fc430ba794d5321723740eeb345c280073e4292ed4302ff657c": { | ||
... | ||
"Name": "redis-slave-3", | ||
"IPv4Address": "192.168.117.2/24", | ||
... | ||
}, | ||
"eddded1ac4c7528640ba0c6befbdaa48faa7cb13905b934ca1f5c69ab364c725": { | ||
... | ||
"Name": "redis-slave-1", | ||
"IPv4Address": "192.168.117.5/24", | ||
... | ||
} | ||
}, | ||
``` | ||
3. Go inside the container to build a Redis cluster. | ||
|
||
```bash | ||
docker exec -it redis-master-1 /bin/bash | ||
``` | ||
|
||
```bash | ||
redis-cli --cluster create \ | ||
192.168.117.4:6379 \ | ||
192.168.117.7:6379 \ | ||
192.168.117.3:6379 \ | ||
192.168.117.5:6379 \ | ||
192.168.117.6:6379 \ | ||
192.168.117.2:6379 \ | ||
--cluster-replicas 1 | ||
``` | ||
4. Specific operations. | ||
|
||
Add a redis monitor center, fill require parameters. | ||
|
||
![](img/docs/help/redis-cluster-add.png) | ||
|
||
final effect. | ||
|
||
![](img/docs/help/redis-cluster-view.png) | ||
Comment on lines
+149
to
+153
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The image path is incorrect and needs to be changed to |
||
|
||
### Configuration Parameters | ||
|
||
Please see [REDIS](https://hertzbeat.apache.org/docs/help/redis) doc. |
157 changes: 157 additions & 0 deletions
157
home/i18n/en/docusaurus-plugin-content-docs/version-v1.1.x/help/redis_cluster.md
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, why add this doc to "version-v1.1.x" directory? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
### Pre-monitoring operations | ||
|
||
1. create a empty folder and add two files. | ||
|
||
*redis.config* | ||
|
||
``` | ||
port 6379 | ||
cluster-enabled yes | ||
cluster-config-file nodes.conf | ||
cluster-node-timeout 5000 | ||
appendonly yes | ||
bind 0.0.0.0 | ||
protected-mode no | ||
|
||
``` | ||
|
||
*docker-compose.yml* | ||
|
||
```yml | ||
services: | ||
redis-master-1: | ||
image: redis:latest | ||
container_name: redis-master-1 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "1000:6379" | ||
|
||
redis-master-2: | ||
image: redis:latest | ||
container_name: redis-master-2 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "2000:6379" | ||
|
||
redis-master-3: | ||
image: redis:latest | ||
container_name: redis-master-3 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "3000:6379" | ||
|
||
redis-slave-1: | ||
image: redis:latest | ||
container_name: redis-slave-1 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "1001:6379" | ||
|
||
redis-slave-2: | ||
image: redis:latest | ||
container_name: redis-slave-2 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "2001:6379" | ||
|
||
redis-slave-3: | ||
image: redis:latest | ||
container_name: redis-slave-3 | ||
command: ["redis-server", "/usr/local/etc/redis/redis.conf"] | ||
volumes: | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
ports: | ||
- "3001:6379" | ||
|
||
networks: | ||
default: | ||
external: | ||
name: hertzbeat-redis-cluster | ||
``` | ||
|
||
2. View the IP addresses of all containers from the network, which is required when building a cluster. | ||
|
||
```bash | ||
docker-compose up -d | ||
docker network inspect hertzbeat-redis-cluste | ||
``` | ||
|
||
``` | ||
"Containers": { | ||
"187b879f73c473b3cbb82ff95f668e65af46115ddaa27f3ff1a712332b981531": { | ||
... | ||
"Name": "redis-slave-2", | ||
"IPv4Address": "192.168.117.6/24", | ||
... | ||
}, | ||
"45e22b64c82e51857fc104436cdd6cc0c5776ad10a2e4b9d8e52e36cfb87217e": { | ||
... | ||
"Name": "redis-master-3", | ||
"IPv4Address": "192.168.117.3/24 | ||
... | ||
}, | ||
"57838ae37956f8af181f9a131eb011efec332b9ed3d49480f59d8962ececf288": { | ||
... | ||
"Name": "redis-master-2", | ||
"IPv4Address": "192.168.117.7/24", | ||
... | ||
}, | ||
"94478d14bd950bcde533134870beb89b392515843027a0595af56dd1e3305a76": { | ||
... | ||
"Name": "redis-master-1", | ||
"IPv4Address": "192.168.117.4/24", | ||
... | ||
}, | ||
"ad055720747e7fc430ba794d5321723740eeb345c280073e4292ed4302ff657c": { | ||
... | ||
"Name": "redis-slave-3", | ||
"IPv4Address": "192.168.117.2/24", | ||
... | ||
}, | ||
"eddded1ac4c7528640ba0c6befbdaa48faa7cb13905b934ca1f5c69ab364c725": { | ||
... | ||
"Name": "redis-slave-1", | ||
"IPv4Address": "192.168.117.5/24", | ||
... | ||
} | ||
}, | ||
``` | ||
3. Go inside the container to build a Redis cluster. | ||
|
||
```bash | ||
docker exec -it redis-master-1 /bin/bash | ||
``` | ||
|
||
```bash | ||
redis-cli --cluster create \ | ||
192.168.117.4:6379 \ | ||
192.168.117.7:6379 \ | ||
192.168.117.3:6379 \ | ||
192.168.117.5:6379 \ | ||
192.168.117.6:6379 \ | ||
192.168.117.2:6379 \ | ||
--cluster-replicas 1 | ||
``` | ||
4. Specific operations. | ||
|
||
Add a redis monitor center, fill require parameters. | ||
|
||
![](img/docs/help/redis-cluster-add.png) | ||
|
||
final effect. | ||
|
||
![](\img/docs/help/redis-cluster-view.png) | ||
|
||
### Configuration Parameters | ||
|
||
Please see [REDIS](https://hertzbeat.apache.org/docs/help/redis) doc. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here need to add a file header in first line ,like this: