redis可视化工具(Redis Desktop Manager) 连接linux

来源:互联网 发布:显示拍摄时间软件 编辑:程序博客网 时间:2024/05/22 06:29

军哥一键式安装 linux  


主要问题是6379的端口没有开放


一、注释redis.conf文件中的:bind 127.0.0.1(在一段文字之前打#号为注释) 

二、设置密码 为了安全一定要设,而且这里如果不绑定ip也不设密码的话,redis是默认保护模式,只能本虚拟机访问,不允许其他ip访问,本人刚开始图方便啥都不设,结果在这里踩坑了;

三、保存配置文件,重启redis服务,查看虚拟机ip;

 

四、接着又是个坑,拿到IP后,返回Windows,开启cmd,通过telnet命令,测试端口是否畅通。;

这时我返回的是“telnet不是内部或外部命令”;

原因:Windows7系统环境下,Telnet客户端默认是关闭状态。找度娘吧http://jingyan.baidu.com/article/6525d4b1377913ac7d2e94eb.html;

然后再试:

 意思是:CentOS的6379端口没有开启;

 centos6.4应该是有问题的 firewall-cmd 的命令不可以用


可以这么干

Centos Linux开启端口 - 解决Centos发布服务外网访问不了的问题
 
#   -------------- 查看服务器端口状态--------------------  
[root@zjxl-2 etc]#/etc/init.d/iptables status  
Table: filter  
Chain INPUT (policy DROP)  
num  target     prot opt source               destination           
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0             
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0             
3    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22   
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 20:30,80,110,443,3300:3500,5700:6100,7001,8000:13000   
5    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED   
  
Chain FORWARD (policy ACCEPT)  
num  target     prot opt source               destination           
  
Chain OUTPUT (policy ACCEPT)  
num  target     prot opt source               destination      
  
  
# ----------------------------发现没有开启6379和6380端口--------------------------------       
# ----------------------------------开启6379端口---------------------------------  
  
[root@zjxl-2 etc]# /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT  
[root@zjxl-2 etc]# /etc/init.d/iptables status  
Table: filter  
Chain INPUT (policy DROP)  
num  target     prot opt source               destination           
1    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:6379   
2    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0             
3    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0             
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22   
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 20:30,80,110,443,3300:3500,5700:6100,7001,8000:13000   
6    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED   
  
Chain FORWARD (policy ACCEPT)  
num  target     prot opt source               destination           
  
Chain OUTPUT (policy ACCEPT)  
num  target     prot opt source               destination       
  
  
# ----------------------------------开启6380端口---------------------------------  
      
  
[root@zjxl-2 etc]# /sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT        开启端口 ok!
  
  
  
#   ------------------------------ 查看服务器端口状态---------------------------  
[root@zjxl-2 etc]# /etc/init.d/iptables status  
Table: filter  
Chain INPUT (policy DROP)  
num  target     prot opt source               destination           
1    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:6380   
2    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:6379   
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0             
4    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0             
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:22   
6    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           multiport dports 20:30,80,110,443,3300:3500,5700:6100,7001,8000:13000   
7    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED   
  
Chain FORWARD (policy ACCEPT)  
num  target     prot opt source               destination           
  
Chain OUTPUT (policy ACCEPT)  
num  target     prot opt source               destination     
  
  
# ----------------------------------保存修改配置 ---------------------------------  
        
  
[root@zjxl-2 etc]# /etc/rc.d/init.d/iptables save  
Saving firewall rules to /etc/sysconfig/iptables:          [  OK  ]  
[root@zjxl-2 etc]#   
 
问题描述:
 
        在Centos服务器上装好Redis缓存服务后,其他机器访问不了,提示连接超时。,郁闷,在网上找到解决方案:
 
    /sbin/iptables -I INPUT -p tcp --dport 6379  -j ACCEPT
     /sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT
 
然后保存:
 
    /etc/rc.d/init.d/iptables save
 
这样重启计算机后,CentOS防火墙默认已经开放了6379和6380端口。
 
这里应该也可以不重启计算机:
 
    /etc/init.d/iptables restart
 
查看CentOS防火墙信息:
 
    /etc/init.d/iptables status
 
关闭CentOS防火墙服务:
 
    /etc/init.d/iptables stop
 
永久关闭:
 
   chkconfig –level 35 iptables off




去开启:

输入firewall-cmd --query-port=6379/tcp,如果返回结果为no,那么证明6379端口确实没有开启。

输入firewall-cmd --add-port=6379/tcp,将6379端口开启,返回success。

然后再执行上一条命令,返回yes,证明端口已经成功开启。

原因:

**由于linux防火墙默认开启,redis的服务端口6379并不在开放规则之内,所有需要将此端口开放访问或者关闭防火墙。

**关闭防火墙命令:sevice iptables stop

**如果是修改防火墙规则,可以修改:/etc/sysconfig/iptables文件

 

再用Telnet 测.返回的结果一片纯黑,ok了;

然后用redie desktop manager连就可以了:


0 0