zoukankan      html  css  js  c++  java
  • Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused (Connection refused)

    一、linux中配置redis,使用java连接测试时报错:

    Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused (Connection refused)

    原因:

    linux中的防火墙没有关闭,在终端中输入以下命令关闭防火墙即可:

    1) Linux操作系统中永久性生效,重启后不会复原

    开启: chkconfig iptables on

    关闭: chkconfig iptables off

    2) 即时生效,重启后复原

    开启: service iptables start

    关闭: service iptables stop

    二、centos7的一些变化,firewalld替换iptables、systemctl 替换service

    1.防火墙命令用firewalld取代了iptables了。

    查看防火墙状态   systemctl status firewalld

    临时关闭防火墙命令,reboot之后,防火墙自动起来。   systemctl stop firewalld

    永久关闭防火墙命令。reboot之后,防火墙不会自动启动    systemctl disable firewalld

    启动防火墙命令   systemctl enable firewalld

    2.用systemctl 代替了service,不过为了向后兼容,centos7中,service还是可以用的。

    如使用systemctl关闭防火墙

    systemctl stop firewalld.service

  • 相关阅读:
    IIS无法显示 XML 页
    asp.net实现sql存取图片
    微软的面试题
    IIS配置.Net问题大全
    Asp.Net调用WebService
    生活本无常,前路更精彩
    【转载】碰到讨厌的老板怎么办
    xxxx不必xx尽,留些xxxx
    【BLOG】Mr梵谷
    机会,从来都是留给有准备的你
  • 原文地址:https://www.cnblogs.com/qq1871707128/p/8065747.html
Copyright © 2011-2022 走看看