QingCloudAppcenter / Redis

Source repo for Redis Apps on QingCloud.
Apache License 2.0
1 stars 9 forks source link

重构 redis cluster 节点 run id 命名方式 #127

Open hlwanghl opened 3 years ago

hlwanghl commented 3 years ago

https://github.com/QingCloudAppcenter/redis/blob/5e0b64cec759967c7a034f5e0d6fc3ead870e77d/ansible/roles/redis-cluster/files/etc/confd/templates/redis-cluster.sh/02.nodes.conf.tmpl#L2

目前 run id 是随机生成的,可读性不好,不便于排查。建议改成格式 [集群ID]-[gid]-[sid]-[padding],便于快速找到节点之间的对应关系:

cl-oaybs2di-001-001--------------------- 172.22.2.55:6379@16379 master - 0 1617105310314 1 connected 0-5460
cl-oaybs2di-001-002--------------------- 172.22.2.56:6379@16379 slave cl-oaybs2di-001-001--------------------- 0 1617105309715 1 connected
cl-oaybs2di-002-003--------------------- 172.22.2.57:6379@16379 master - 0 1617105310016 2 connected 5461-10921
cl-oaybs2di-002-004--------------------- 172.22.2.58:6379@16379 slave cl-oaybs2di-002-003--------------------- 0 1617105312319 2 connected
cl-oaybs2di-003-005--------------------- 172.22.2.59:6379@16379 myself,master - 0 1617105311318 0 connected 10922-16383
cl-oaybs2di-003-006--------------------- 172.22.2.54:6379@16379 slave cl-oaybs2di-003-005--------------------- 0 1617105311000 0 connected
  echo -n {{ getv "/cluster/cluster_id" }}-{{ getv "/host/gid" }}-{{ getv "/host/sid" }}------------------------------ | head -c 40