`
sillycat
  • 浏览: 2527481 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Redis Cluster 2019(1)Set Up 3 Masters and 3 Replicas Version 5.0.5

 
阅读更多
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



分享到:
评论

相关推荐

    redis-5.0.5.tar.gz

    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-...

    Redis Cluster5.0.5.rar

    基于Redis Cluster 5.0.5集群部署,单节点多端口测试部署。附件脚本可以根据自定义模板,自动创建目录及配置文件。包括启动进程,根据IP来启动集群,以及重新加载配置文件等操作。./redis.sh create|start|stop|...

    redis-5.0.5-windows.zip

    3. **丰富的数据结构**:除了基本的字符串,Redis还支持哈希表(Hash)、列表(List)、集合(Set)和有序集合(Sorted Set),这些数据结构可以满足多种复杂应用场景的需求。 4. **事务处理**:Redis提供了事务...

    redis-5.0.5.zip windows版本

    本压缩包"redis-5.0.5.zip"是针对Windows平台编译的Redis 5.0.5版本,解决了在Windows环境下使用较新Redis版本的需求。 Redis 5.0.5是Redis的一个稳定版本,带来了多项改进和优化。以下将详细介绍Redis及其5.0.5...

    RedisCluster集群(Spring访问Redis)

    **RedisCluster集群与Spring访问Redis详解** Redis是一个高性能的键值数据库,广泛应用于缓存、消息中间件等场景。在大型分布式系统中,为了提供高可用性和数据冗余,我们通常会采用Redis Cluster来构建集群。本文...

    rediscluster.rar

    Redis Cluster是Redis官方提供的分布式解决方案,它允许用户在多个节点之间分发数据,从而实现高可用性和水平扩展。本文将详细介绍Redis Cluster的工作原理、配置、使用以及与MySQL数据库的配合。 **一、Redis ...

    redisCluster集群demo

    1. **Redis Cluster架构**: Redis Cluster采用无中心架构,每个节点都保存部分数据,并通过Gossip协议进行节点间的通信,用于发现新节点、传播节点状态变化等。每个节点都知道集群的配置信息,包括其他节点的位置...

    rediscluster配置文件.zip

    Redis Cluster是Redis官方提供的分布式集群解决方案,用于实现数据的分布式存储和高可用性。这个压缩包文件"rediscluster配置文件.zip"包含了一系列配置文件,用于搭建一个三主三从的Redis Cluster架构。在这个架构...

    codis/redis 迁移redis cluster工具

    1. **准备工作**:确认源系统(Codis或Redis)和目标系统(Redis或Codis)的配置,包括版本兼容性、网络可达性等。同时,确保目标系统有足够的资源来接收迁移的数据。 2. **工具安装**:下载并安装迁移工具,通常是...

    Redis高可用集群Redis Cluster搭建

    1. Redis Cluster 概念 Redis Cluster 是一种高可用、高性能的集群解决方案,通过哈希槽(Hash Slot)来实现数据分片和高可用性。集群会预先分配 16384 个槽,并将这些槽分配给具体的服务节点。通过对 Key 进行 CRC...

    完整搭建redis-cluster

    **Redis Cluster 搭建全攻略** Redis 是一个高性能的键值存储系统,而 Redis Cluster 是它的分布式解决方案,提供数据的自动分片、故障转移和高可用性。本指南将详细讲解如何完整地搭建一个 Redis Cluster,同时...

    jfinal redis cluster plugin-JFinal redis cluster集群插件

    在实际应用中,可以利用插件提供的API进行操作,如`set`、`get`、`del`等,这些方法应该已经封装了与Redis Cluster通信的逻辑。需要注意的是,由于Redis Cluster的数据分布特性,插入和查询数据可能会涉及到多个节点...

    redis cluster spring整合代码

    **Redis Cluster简介** Redis Cluster是Redis的分布式解决方案,它提供了数据分片、故障转移和高可用性等功能。在大型系统中,单个Redis实例可能无法满足存储和性能需求,这时就需要利用Redis Cluster来扩展和分散...

    Redis-5.0.5 Windows版本

    1. **下载与解压**:首先,你需要从官方网站或可信的第三方源下载Redis的Windows版本,文件名为`redis-5.0.5-bin.zip`。解压缩后,你会得到包含所有Redis可执行文件和脚本的文件夹。 2. **服务注册**:描述中提到的...

    新redis5.0.5集群搭建 by crj.docx

    Redis 5.0.5 集群搭建详解 Redis 是一个开源、基于内存的数据存储系统,提供了多种数据结构,如字符串、哈希表、列表、集合、有序集合等。Redis 的高性能和低延迟使其广泛应用于缓存、消息队列、数据存储等领域。...

    Tomcat 8+ redis cluster session

    nodeAddresses="redis1:6379,redis2:6379,redis3:6379"/> ``` `configPath`指定了Redisson的配置文件路径,`nodeAddresses`则列出了Redis集群的节点地址。 3. **配置Redisson YAML**:创建一个`redisson.yaml`...

    rediscluster集群demo

    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`连接到任意...

    Rediscluster1.zip

    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.zip

    RedisCluster是Redis的一种分布式集群解决方案,它允许将数据分散存储在多个节点上,以实现高可用性和可扩展性。在RedisCluster中,每个节点都存储一部分数据,并且负责处理一部分客户端请求,这样可以分摊服务器...

Global site tag (gtag.js) - Google Analytics