启动redis服务的命令 如何在linux下链接远程redis?

[更新]
·
·
分类:互联网
1934 阅读

启动redis服务的命令

如何在linux下链接远程redis?

如何在linux下链接远程redis?

在Redis目录下 开启Redis 这个窗口就不能继续操作了 scr/redis-server 另开启一个命令行窗口 进入Redis目录 可以进行测试 src/redis-cli quit可以退出当前client

客户端怎样查看redis的命令?

Redis 命令用于在 redis 服务上执行操作。所以我们必须要启动Redis服务程序,也就是redis安装目录下的redis-server.exe,你可以双击执行,也可以打开cmd窗口,将路径定位到Redis安装目录下,通过redis-server命令执行。要在 redis 服务上执行命令需要一个 redis 客户端。Redis 客户端在我们之前下载的的 redis 的安装包中,也就是redis-cli.exe,同理,可以双击执行也可以通过命令执行。

大数据怎么入门学习好?

大数据入门首先要学习javase,掌握了javase之后,最好再学学javaee,如果不学的话,影响也不是特别大。接下来要学的东西就比较多了,主要是两块,一种是离线计算,以hadoop为主,一种是实时计算,以spark为主,当然大数据不是一两个技术的组合,而是一整套完整的生态系统,所以要学的东西还是很多的,大数据主要解决的是海量数据的存储和计算问题,建议还是把java学好,因为很多大数据的软件都是基于java编写的,所以入门大数据的话,建议先从java入门学习比较好!

redis 3.x版本 怎么解决hash槽异常?

在搭建Redis5.x版本的集群环境曾出现各节点无法互相发现与Hash槽分配异常 CLUSTERDOWN Hash slot not served的情况,故而把解决方式记录下来。
在以下三台虚拟机机器搭建Redis集群——
192.168.200.160
192.168.200.161
192.168.200.162
启动三台Redis集群,然后连接其中一台客户端,随便set一个指令,测试集群是否可行,结果报出异常(error) CLUSTERDOWN Hash slot not served提示——
[ bin]$ ./redis-cli -c -h 192.168.200.162
192.168.200.162:6379gt set zhu #34test#34
(error) CLUSTERDOWN Hash slot not served
首先,先看一下集群各个节点是否能互相发现,执行以下指令查看各个节点连接情况——
192.168.200.162:6379gt cluster nodes
8c5809df064ad7234c6475555411afda026c230f : myself,master - 0 0 0 connected
接着再检查一下当前集群状态,发现目前状态为fail,说明集群没有互连成功——
192.168.200.162:6379gt cluster info
cluster_state:fail
cluster_slots_assigned:0
cluster_slots_ok:0
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:0
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0
发现,三台Redis搭建的集群没有互相发现,故而,只需要在其中一台客户端上执行以下指令,手动帮助该节点去发现其他两个节点,因集群是互连的,所以只需要在其中一台上手动发现另外两台即可——
192.168.200.162:6379gt cluster meet 192.168.200.160 6379
OK
192.168.200.162:6379gt cluster meet 192.168.200.161 6379
OK
完成以上指令,查看各个节点状态,发现当前节点已经能发现其他两台机器节点了——
192.168.200.162:6379gt cluster nodes
a0cf910effc52eda7c5561746c42f8bcd710f735 192.168.200.161: master - 0 1639410795898 0 connected
5e5f08f9ec39910cc250239b4f44e701d4b831f5 192.168.200.160: master - 0 1639410794885 1 connected
8c5809df064ad7234c6475555411afda026c230f 192.168.200.162: myself,master - 0 1639410795000 2 connected
再测试集群状态,发现状态依然还是失败,且还报CLUSTERDOWN Hash slot not served异常——
192.168.200.162:6379gt cluster info
cluster_state:fail
cluster_slots_assigned:0
cluster_slots_ok:0
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:3
cluster_size:0
cluster_current_epoch:2
cluster_my_epoch:2
cluster_stats_messages_ping_sent:26
cluster_stats_messages_pong_sent:30
cluster_stats_messages_meet_sent:3
cluster_stats_messages_sent:59
cluster_stats_messages_ping_received:30
cluster_stats_messages_pong_received:29
cluster_stats_messages_received:59
192.168.200.162:6379gt set zhu #34test#34
(error) CLUSTERDOWN Hash slot not served
到这一步,说明当前集群存在hash槽异常情况,那么,可以执行以下指令修复下——
[ bin]$ ./redis-cli --cluster fix 192.168.200.162:6379
回车执行,顿时就会运行打印很多以下信息,说明正在对16384个hash槽重新分配——
gtgtgt Covering slot 10620 with 192.168.200.162:6379
gtgtgt Covering slot 3059 with 192.168.200.162:6379
gtgtgt Covering slot 9764 with 192.168.200.162:6379
gtgtgt Covering slot 11335 with 192.168.200.162:6379
gtgtgt Covering slot 6368 with 192.168.200.162:6379
gtgtgt Covering slot 4884 with 192.168.200.162:6379
gtgtgt Covering slot 15271 with 192.168.200.162:6379
gtgtgt Covering slot 5109 with 192.168.200.162:6379
......
等运行完成后,我们再检查一下集群状态,发现状态已经由刚刚的fail变出ok了,说明hash槽已经正确分配——
192.168.200.162:6379gt cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:3
cluster_size:3
cluster_current_epoch:19
cluster_my_epoch:18
cluster_stats_messages_ping_sent:1514
cluster_stats_messages_pong_sent:1486
cluster_stats_messages_meet_sent:3
cluster_stats_messages_sent:3003
cluster_stats_messages_ping_received:1486
cluster_stats_messages_pong_received:1517
cluster_stats_messages_received:3003
最后,在其中一台集群上输入以下指令测试下,没有报异常了——
192.168.200.162:6379gt set test zhu
OK
另外,在其他两台机器上,输入以下指令,都可以获取到192.168.200.162机器redis输入的测试k-v值了
192.168.200.160:6379gt get test
-gt Redirected to slot [6918] located at 192.168.200.162:6379
#34zhu#34