- 浏览: 2540742 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Redis Cluster 2019(1)
Install the latest version 5.0.5 currently
> wget http://download.redis.io/releases/redis-5.0.5.tar.gz
Unzip and go to that directory
> make distclean
> make
Prepare the installation directory
> mkdir ~/tool/redis-5.0.5
> mkdir ~/tool/redis-5.0.5/bin
> cp src/redis-server ~/tool/redis-5.0.5/bin/
> cp src/redis-cli ~/tool/redis-5.0.5/bin/
> cp src/redis-benchmark ~/tool/redis-5.0.5/bin/
> mkdir ~/tool/redis-5.0.5/conf
> cp redis.conf ~/tool/redis-5.0.5/conf/
Soft link
> sudo ln -s /home/carl/tool/redis-5.0.5 /opt/redis-5.0.5
> sudo ln -s /opt/redis-5.0.5 /opt/redis
Prepare the cluster conf
> mkdir cluster-conf
> mkdir cluster-conf/7001
> mkdir cluster-conf/7002
Prepare the default configuration to the cluster
> cp conf/redis.conf cluster-conf/7001/
> cp conf/redis.conf cluster-conf/7002/
Change the cluster-conf/7001/redis.conf as follow:
port 7001
appendonly yes
cluster-enabled yes
cluster-config-file nodes-7001.conf
cluster-node-timeout 15000
bind 0.0.0.0
Prepare the same thing for ubuntu-master:7001, ubuntu-master:7002, ubuntu-dev2:7001, ubuntu-dev2:7002
Command to start them one by one
> bin/redis-server ./cluster-conf/7001/redis.conf
> bin/redis-server ./cluster-conf/7002/redis.conf
I saw something like this in the logging
No cluster configuration found, I'm 8b65491322a3c5d650a6027b1e47465fb5a03c32
Run this command to initiate the cluster
> redis-cli --cluster create ubuntu-master:7001 ubuntu-master:7002 ubuntu-dev2:7001 ubuntu-dev2:7002 --cluster-replicas 1
Error Message as follow:
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 4 nodes and 1 replicas per node.
*** At least 6 nodes are required.
I will try to create 7003 on ubuntu-dev2 and ubuntu-master.
Another error message:
Node ubuntu-master:7002 replied with error:
ERR Invalid node address specified: ubuntu-master:7001
Solution:
Will use IP instead of hostname
> redis-cli --cluster create 192.168.56.101:7001 192.168.56.101:7002 192.168.56.101:7003 192.168.56.3:7001 192.168.56.3:7002 192.168.56.3:7003 --cluster-replicas 1
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
Connect and Verify
> redis-cli -c -h ubuntu-master -p 7001
set foo bar
-> Redirected to slot [12182] located at 192.168.56.101:7002
OK
192.168.56.101:7002> get foo
"bar"
Show all the nodes information
> cluster nodes
4aaa84498db791f6865d095c1beb59c1c2d476c7 192.168.56.101:7003@17003 slave fb1174b72aeb5ffd0152720c21e2690a5380cd28 0 1560192317000 4 connected
8b65491322a3c5d650a6027b1e47465fb5a03c32 192.168.56.3:7002@17002 slave e96b06f852023e64546e7566fd2ae417731c78c3 0 1560192316000 5 connected
fb1174b72aeb5ffd0152720c21e2690a5380cd28 192.168.56.3:7001@17001 master - 0 1560192319919 4 connected 5461-10922
36235b5b5954b15ad90d6d9acdee7d83eacb1a2f 192.168.56.101:7001@17001 master - 0 1560192319000 1 connected 0-5460
eae59392de289ead846ab08be2893deda52ed3d3 192.168.56.3:7003@17003 slave 36235b5b5954b15ad90d6d9acdee7d83eacb1a2f 0 1560192318897 6 connected
e96b06f852023e64546e7566fd2ae417731c78c3 192.168.56.101:7002@17002 myself,master - 0 1560192318000 2 connected 10923-16383
Info will show more information
> info
# Server
redis_version:5.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7d80a20d45e418a3
redis_mode:cluster
It seems that this one is good tool
https://github.com/LittlePeng/redis-monitor
https://github.com/steelThread/redmon
> sudo apt install ruby
> sudo apt install ruby-dev
> sudo gem install redmon
Check the installation
> redmon -h
Not working, I think should be version issues.
Try this one
https://github.com/nkrode/RedisLive
> sudo apt-get install python python-dev
> sudo apt install python-pip
> pip install tornado
> pip install redis
> pip install python-dateutil
> python -V
Python 2.7.16
> git clone https://github.com/kumarnitin/RedisLive.git
Copy to working directory
> mv RedisLive ~/tool/
> sudo ln -s /home/carl/tool/RedisLive /opt/redislive
> cd /opt/redislive
> cp src/redis-live.conf.example src/redis-live.conf
After I configure that, I get error as follow
AttributeError: 'str' object has no attribute 'iteritems'
I think it is python version issues.
I used to use this very old tool
https://github.com/junegunn/redis-stat
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003
It is ok to use it. And it seems that we can send the logging to Elastisearch as well.
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --server=7000
It will open a webUI
http://ubuntu-dev2:7000/
We can put that into daemon as well
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --server=7000 --daemon
We can send the data to Elasticsearch as well. I start to run the elastic and Kibana. Let me try to logging.
There is a known issue after this command
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --es=http://ubuntu-master:9200/redisstat
Exception:
[2019/06/10 22:18:57@elasticsearch] [406] {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
A workaround, we can gather all the information to CSV file
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --csv=./redis-stat.csv
I think Filebeat can gather all these informations to Logstash, and Logstash convert CSV to JSON in Elasticsearch with data format
References:
https://redis.io/topics/cluster-tutorial
Useful Redis Tool
https://github.com/AlexStocks/redis-tool-set
Install the latest version 5.0.5 currently
> wget http://download.redis.io/releases/redis-5.0.5.tar.gz
Unzip and go to that directory
> make distclean
> make
Prepare the installation directory
> mkdir ~/tool/redis-5.0.5
> mkdir ~/tool/redis-5.0.5/bin
> cp src/redis-server ~/tool/redis-5.0.5/bin/
> cp src/redis-cli ~/tool/redis-5.0.5/bin/
> cp src/redis-benchmark ~/tool/redis-5.0.5/bin/
> mkdir ~/tool/redis-5.0.5/conf
> cp redis.conf ~/tool/redis-5.0.5/conf/
Soft link
> sudo ln -s /home/carl/tool/redis-5.0.5 /opt/redis-5.0.5
> sudo ln -s /opt/redis-5.0.5 /opt/redis
Prepare the cluster conf
> mkdir cluster-conf
> mkdir cluster-conf/7001
> mkdir cluster-conf/7002
Prepare the default configuration to the cluster
> cp conf/redis.conf cluster-conf/7001/
> cp conf/redis.conf cluster-conf/7002/
Change the cluster-conf/7001/redis.conf as follow:
port 7001
appendonly yes
cluster-enabled yes
cluster-config-file nodes-7001.conf
cluster-node-timeout 15000
bind 0.0.0.0
Prepare the same thing for ubuntu-master:7001, ubuntu-master:7002, ubuntu-dev2:7001, ubuntu-dev2:7002
Command to start them one by one
> bin/redis-server ./cluster-conf/7001/redis.conf
> bin/redis-server ./cluster-conf/7002/redis.conf
I saw something like this in the logging
No cluster configuration found, I'm 8b65491322a3c5d650a6027b1e47465fb5a03c32
Run this command to initiate the cluster
> redis-cli --cluster create ubuntu-master:7001 ubuntu-master:7002 ubuntu-dev2:7001 ubuntu-dev2:7002 --cluster-replicas 1
Error Message as follow:
*** ERROR: Invalid configuration for cluster creation.
*** Redis Cluster requires at least 3 master nodes.
*** This is not possible with 4 nodes and 1 replicas per node.
*** At least 6 nodes are required.
I will try to create 7003 on ubuntu-dev2 and ubuntu-master.
Another error message:
Node ubuntu-master:7002 replied with error:
ERR Invalid node address specified: ubuntu-master:7001
Solution:
Will use IP instead of hostname
> redis-cli --cluster create 192.168.56.101:7001 192.168.56.101:7002 192.168.56.101:7003 192.168.56.3:7001 192.168.56.3:7002 192.168.56.3:7003 --cluster-replicas 1
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
Connect and Verify
> redis-cli -c -h ubuntu-master -p 7001
set foo bar
-> Redirected to slot [12182] located at 192.168.56.101:7002
OK
192.168.56.101:7002> get foo
"bar"
Show all the nodes information
> cluster nodes
4aaa84498db791f6865d095c1beb59c1c2d476c7 192.168.56.101:7003@17003 slave fb1174b72aeb5ffd0152720c21e2690a5380cd28 0 1560192317000 4 connected
8b65491322a3c5d650a6027b1e47465fb5a03c32 192.168.56.3:7002@17002 slave e96b06f852023e64546e7566fd2ae417731c78c3 0 1560192316000 5 connected
fb1174b72aeb5ffd0152720c21e2690a5380cd28 192.168.56.3:7001@17001 master - 0 1560192319919 4 connected 5461-10922
36235b5b5954b15ad90d6d9acdee7d83eacb1a2f 192.168.56.101:7001@17001 master - 0 1560192319000 1 connected 0-5460
eae59392de289ead846ab08be2893deda52ed3d3 192.168.56.3:7003@17003 slave 36235b5b5954b15ad90d6d9acdee7d83eacb1a2f 0 1560192318897 6 connected
e96b06f852023e64546e7566fd2ae417731c78c3 192.168.56.101:7002@17002 myself,master - 0 1560192318000 2 connected 10923-16383
Info will show more information
> info
# Server
redis_version:5.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7d80a20d45e418a3
redis_mode:cluster
It seems that this one is good tool
https://github.com/LittlePeng/redis-monitor
https://github.com/steelThread/redmon
> sudo apt install ruby
> sudo apt install ruby-dev
> sudo gem install redmon
Check the installation
> redmon -h
Not working, I think should be version issues.
Try this one
https://github.com/nkrode/RedisLive
> sudo apt-get install python python-dev
> sudo apt install python-pip
> pip install tornado
> pip install redis
> pip install python-dateutil
> python -V
Python 2.7.16
> git clone https://github.com/kumarnitin/RedisLive.git
Copy to working directory
> mv RedisLive ~/tool/
> sudo ln -s /home/carl/tool/RedisLive /opt/redislive
> cd /opt/redislive
> cp src/redis-live.conf.example src/redis-live.conf
After I configure that, I get error as follow
AttributeError: 'str' object has no attribute 'iteritems'
I think it is python version issues.
I used to use this very old tool
https://github.com/junegunn/redis-stat
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003
It is ok to use it. And it seems that we can send the logging to Elastisearch as well.
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --server=7000
It will open a webUI
http://ubuntu-dev2:7000/
We can put that into daemon as well
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --server=7000 --daemon
We can send the data to Elasticsearch as well. I start to run the elastic and Kibana. Let me try to logging.
There is a known issue after this command
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --es=http://ubuntu-master:9200/redisstat
Exception:
[2019/06/10 22:18:57@elasticsearch] [406] {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}
A workaround, we can gather all the information to CSV file
> redis-stat ubuntu-dev2:7001 ubuntu-dev2:7002 ubuntu-dev2:7003 ubuntu-master:7001 ubuntu-master:7002 ubuntu-master:7003 --csv=./redis-stat.csv
I think Filebeat can gather all these informations to Logstash, and Logstash convert CSV to JSON in Elasticsearch with data format
References:
https://redis.io/topics/cluster-tutorial
Useful Redis Tool
https://github.com/AlexStocks/redis-tool-set
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 310I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 467NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 361Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 363Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 328Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 421Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 428Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 364Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 444VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 376Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 465NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 413Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 330Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 242GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 443GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 320GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 306Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 310Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 285Serverless with NodeJS and Tenc ...
相关推荐
redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-5.0.5.redis-...
3. **丰富的数据结构**:除了基本的字符串,Redis还支持哈希表(Hash)、列表(List)、集合(Set)和有序集合(Sorted Set),这些数据结构可以满足多种复杂应用场景的需求。 4. **事务处理**:Redis提供了事务...
基于Redis Cluster 5.0.5集群部署,单节点多端口测试部署。附件脚本可以根据自定义模板,自动创建目录及配置文件。包括启动进程,根据IP来启动集群,以及重新加载配置文件等操作。./redis.sh create|start|stop|...
本压缩包"redis-5.0.5.zip"是针对Windows平台编译的Redis 5.0.5版本,解决了在Windows环境下使用较新Redis版本的需求。 Redis 5.0.5是Redis的一个稳定版本,带来了多项改进和优化。以下将详细介绍Redis及其5.0.5...
1. **下载与解压**:首先,你需要从官方网站或可信的第三方源下载Redis的Windows版本,文件名为`redis-5.0.5-bin.zip`。解压缩后,你会得到包含所有Redis可执行文件和脚本的文件夹。 2. **服务注册**:描述中提到的...
**RedisCluster集群与Spring访问Redis详解** Redis是一个高性能的键值数据库,广泛应用于缓存、消息中间件等场景。在大型分布式系统中,为了提供高可用性和数据冗余,我们通常会采用Redis Cluster来构建集群。本文...
Redis Cluster是Redis官方提供的分布式解决方案,它允许用户在多个节点之间分发数据,从而实现高可用性和水平扩展。本文将详细介绍Redis Cluster的工作原理、配置、使用以及与MySQL数据库的配合。 **一、Redis ...
1. **Redis Cluster架构**: Redis Cluster采用无中心架构,每个节点都保存部分数据,并通过Gossip协议进行节点间的通信,用于发现新节点、传播节点状态变化等。每个节点都知道集群的配置信息,包括其他节点的位置...
Redis Cluster是Redis官方提供的分布式集群解决方案,用于实现数据的分布式存储和高可用性。这个压缩包文件"rediscluster配置文件.zip"包含了一系列配置文件,用于搭建一个三主三从的Redis Cluster架构。在这个架构...
1. Redis Cluster 概念 Redis Cluster 是一种高可用、高性能的集群解决方案,通过哈希槽(Hash Slot)来实现数据分片和高可用性。集群会预先分配 16384 个槽,并将这些槽分配给具体的服务节点。通过对 Key 进行 CRC...
**Redis Cluster 搭建全攻略** Redis 是一个高性能的键值存储系统,而 Redis Cluster 是它的分布式解决方案,提供数据的自动分片、故障转移和高可用性。本指南将详细讲解如何完整地搭建一个 Redis Cluster,同时...
在实际应用中,可以利用插件提供的API进行操作,如`set`、`get`、`del`等,这些方法应该已经封装了与Redis Cluster通信的逻辑。需要注意的是,由于Redis Cluster的数据分布特性,插入和查询数据可能会涉及到多个节点...
**Redis Cluster简介** Redis Cluster是Redis的分布式解决方案,它提供了数据分片、故障转移和高可用性等功能。在大型系统中,单个Redis实例可能无法满足存储和性能需求,这时就需要利用Redis Cluster来扩展和分散...
Redis 5.0.5 集群搭建详解 Redis 是一个开源、基于内存的数据存储系统,提供了多种数据结构,如字符串、哈希表、列表、集合、有序集合等。Redis 的高性能和低延迟使其广泛应用于缓存、消息队列、数据存储等领域。...
nodeAddresses="redis1:6379,redis2:6379,redis3:6379"/> ``` `configPath`指定了Redisson的配置文件路径,`nodeAddresses`则列出了Redis集群的节点地址。 3. **配置Redisson YAML**:创建一个`redisson.yaml`...
redis-cli --cluster create 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 --cluster-replicas 1 ``` 这会创建一个包含3个主节点的集群,每个主节点有一个副本。 4. 验证集群状态:通过`redis-cli`连接到任意...
redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 ``` 这将在指定的三个IP地址上分别启动7000、7001、7002端口的Redis节点,并为每个主节点创建一个副本。 在Ruby代码中,可以像...
RedisCluster是Redis的一种分布式集群解决方案,它允许将数据分散存储在多个节点上,以实现高可用性和可扩展性。在RedisCluster中,每个节点都存储一部分数据,并且负责处理一部分客户端请求,这样可以分摊服务器...
1. 配置时,至少需要三个节点才能构成一个基本的Redis Cluster,且推荐为奇数个节点以防止投票时出现平局。 2. 数据迁移是自动进行的,但需要在添加或移除节点时,谨慎操作以避免数据丢失。 3. 不支持某些命令,如:...