Kubernetes Service,Redis Sentinel,没有一致地返回Redis主IP和端口,并且所有pod都在docker容器中 . 我已经使用了https://github.com/kubernetes/kubernetes/tree/master/examples/redis和https://github.com/helm/helm - redis群集
当我连接到Kubernetes服务(10.3.251.152,26379 / TCP)时,它应确定Redis Sentinel主服务器(ip:'10.0.0.68',端口:'6379'),然后与它 Build 连接 . 但有时,Kubernetes服务返回(ip:'10.0.0.68',port:'6379')和其他一些时间,它返回Kubernetes服务(10.3.251.152,26379 / TCP)作为哨兵主IP . 这很多我们可以在program Log中看到与sentinel master连接
在两个(kubernetes sentinel示例,helm.sh的redis集群)情况下,会发生这种不一致 .
你可以在这里看到服务和pod详细信息..
如何进行故障排除?
useRedisSentinel true
redisSentinelHost 10.3.251.152 redisSentinelPort 26379
Queueing psubscribe for next server connection.
sentinelClient { domain: null,
_events:
{ 'sentinel disconnected': [Function],
'failover start': [Function],
'switch master': [Function] },
_maxListeners: undefined,
options:
{ master_debug: true,
port: '26379',
host: '10.3.251.152',
and so on ..
}
}
有关主/从/哨兵详细信息的更多详细信息
masters [ { name: 'mymaster',
ip: '10.0.0.68',
port: '6379',
runid: '33798857c71ebf2c85c7095291d453cb143cea7e',
flags: 'master',
'pending-commands': '0',
'last-ok-ping-reply': '0',
'last-ping-reply': '518',
'info-refresh': '518',
'num-slaves': '60000',
'num-other-sentinels': '9021',
quorum: 'master' } ]
mymaster slaves [ { name: '10.0.0.70:6379',
ip: '10.0.0.70',
port: '6379',
runid: 'ce2330d9071e091e8d808017d761cbdae1d286b9',
flags: 'slave',
'pending-commands': '0',
'last-ok-ping-reply': '0',
'last-ping-reply': '518',
'info-refresh': '518',
'master-link-down-time': '60000',
'master-link-status': '9021',
'master-host': 'slave',
'master-port': '33297880',
'slave-priority': '0' },
{ name: '10.0.0.69:6379',
ip: '10.0.0.69',
port: '6379',
runid: 'a1e063c71a4ef93a8c5769aa29cb1d8dbf669579',
flags: 'slave',
'pending-commands': '0',
'last-ok-ping-reply': '0',
'last-ping-reply': '518',
'info-refresh': '518',
'master-link-down-time': '60000',
'master-link-status': '9021',
'master-host': 'slave',
'master-port': '33297888',
'slave-priority': '0' } ]
mymaster sentinels [ { name: '10.0.0.71:26379',
ip: '10.0.0.71',
port: '26379',
runid: '6f787783753fa446c6ecb118d07339d51f1fda14',
flags: 'sentinel',
'pending-commands': '0',
'last-ok-ping-reply': '0',
'last-ping-reply': '518',
'last-hello-message': '518',
'can-failover-its-master': '60000' },
{ name: '10.0.0.68:26379',
ip: '10.0.0.68',
port: '26379',
runid: '7542fbbb0c36c4d171c10b492f67a416d794fc96',
flags: 'sentinel',
'pending-commands': '0',
'last-ok-ping-reply': '0',
'last-ping-reply': '518',
'last-hello-message': '518',
'can-failover-its-master': '60000' } ]
mymaster getMasterAddress { ip: '10.0.0.68', port: '6379' }
我该如何进行故障排除?