通过ssh进行Redis复制无法启动(Redis replication through ssh not starting)

编程入门 行业动态 更新时间:2024-10-26 06:27:48
通过ssh进行Redis复制无法启动(Redis replication through ssh not starting)

将Rails应用程序基础架构从一个托管区域一点一点地迁移到另一个托管区域(只有公共Internet连接它们)我需要将Redis实例从一侧迁移到另一侧。

我倾向于使用主从设置来确保没有丢失任何内容,而且我们没有任何停机时间,而不是转储数据(即使很小:只是队列)。

互联网说SSH是我的朋友。

Old1是托管主Redis服务器的旧服务器。 Redis必然会绑定服务器的专用网络IP。

New1是托管新Redis服务器的新服务器。

在New1上我设置了ssh隧道/端口转发:

ssh -L 7380:<private_old1_ip>:6379 username@old1.publicname.ex

仍然在New1上我检查我可以连接到两个实例:

redis-cli -p 6379 redis-cli -p 7380

在两个基地,信息都有效。

在New1:Redis上,通过redis-cli我设置了slave模式:

salveof localhost 7380

现在这里是关于New1:Redis的信息:

# Replication role:slave master_host:localhost master_port:7380 master_link_status:down master_last_io_seconds_ago:-1 master_sync_in_progress:0 master_link_down_since_seconds:1399544048 slave_priority:100 slave_read_only:1 connected_slaves:0

而Old1:Redis(通过隧道):

# Replication role:master connected_slaves:1 slave0:<private_old1_ip>,6379,online

所以隧道已经启动并正常工作。 有足够的内存可用。 从站似乎在Old1侧连接(但与Old1 ip一起出现)。 从站表示主链路状态已关闭且同步未在进行中。

我错过了什么?

Migrating bit by bit a Rails app infrastructure from one hosting zone to another (with only public internet linking them) I need to migrate a Redis instance from one side to the other.

Rather than dumping the data (even small : just queues), I'd prefer to use a master-slave setup to ensure that nothing is lost and that we don't have any down time.

Internet says SSH is my friend.

Old1 is the old server hosting the primary Redis server. Redis there is bound to a private network IP of the server.

New1 is the new server hosting the new Redis server.

On New1 I setup the ssh tunnel / port forwarding :

ssh -L 7380:<private_old1_ip>:6379 username@old1.publicname.ex

Still on New1 I check that I can connect to both instances :

redis-cli -p 6379 redis-cli -p 7380

In both bases, info works.

On New1:Redis, through redis-cli I setup the slave mode :

salveof localhost 7380

Now here is what info says on New1:Redis :

# Replication role:slave master_host:localhost master_port:7380 master_link_status:down master_last_io_seconds_ago:-1 master_sync_in_progress:0 master_link_down_since_seconds:1399544048 slave_priority:100 slave_read_only:1 connected_slaves:0

While Old1:Redis (through the tunnel still) :

# Replication role:master connected_slaves:1 slave0:<private_old1_ip>,6379,online

So the tunnel is up, and working. There is plenty of memory available. The slave appears connected on Old1 side (but appears with the Old1 ip). The slave says master link status is down and that the sync is not in progress.

What am I missing ?

最满意答案

事实上问题很简单。

日志目标设置为/ dev / null,因此/ var / log中没有出现任何内容

存储目录设置为./,显然与守护程序设置不兼容,并导致同步权限错误。

The problem was quite simple in fact.

The log destination was set to /dev/null so nothing was appearing in /var/log

The storage directory was set to ./ which obviously don't play well with daemon settings and was causing permissions errors on synchronisation.

更多推荐

本文发布于:2023-08-04 23:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1423285.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法启动   Redis   ssh   replication   starting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!