centos下使用redis报错cant resolve localhost address之解决
摘要:今天在centos下部署使用redis报了如下错误:redis.clients.jedis.HostAndPort.getLocalHostQuietly cant resolve localhost address。java.net。经查是主机名导致的,在/etc/hosts中添加本机主机名后,问题解决。
今天在centos下部署使用redis报了如下错误:
22-Sep-2022 09:21:05.477 SEVERE [main] redis.clients.jedis.HostAndPort.getLocalHostQuietly cant resolve localhost address java.net.UnknownHostException: host-192-168-1-100: host-192-168-1-100: Name or service not known at java.net.InetAddress.getLocalHost(InetAddress.java:1506) at redis.clients.jedis.HostAndPort.getLocalHostQuietly(HostAndPort.java:105) at redis.clients.jedis.HostAndPort.<clinit>(HostAndPort.java:12) at redis.clients.jedis.JedisFactory.<init>(JedisFactory.java:37) at redis.clients.jedis.JedisPool.<init>(JedisPool.java:185) at redis.clients.jedis.JedisPool.<init>(JedisPool.java:162) at redis.clients.jedis.JedisPool.<init>(JedisPool.java:92)
经查,是主机名导致的。下面是解决办法:
查看主机名 #hostname 查看上述主机名是否包含在第一行内容中,如果没有添加上即可 #cat /etc/hosts
其实从上面报错中能看出一些关键信息:主机名是host-192-168-1-100,但是该名称没有包含在/etc/hosts文件中。添加后再试,问题解决。
双11云服务器热购推广(腾讯云):2核+4G内存+3M带宽=688元/3年(仅限新用户)
除非注明,文章均为草根java原创,转载请注明本文地址:
https://www.caogenjava.com/detail/146.html
上一篇:springboot过滤器被同一请求连续触发两次之解决
下一篇:winscp上传文件报Received SSH2_MSG_CHANNEL_DATA for nonexistent channel 0之解决
相关链接
-
1微信开发errcode:45015,errmsg:response out of time limit之完美解决
-
2archive is not a ZIP archive之解决
-
3火狐每次启动都弹出迅雷提示下载openh264之解决
-
4Eclipse中提示Could not find the main class之解决
-
5以小米6为例图说安卓手机如何安装谷歌四件套
-
6在微信中调用外部浏览器实现文件下载之解决
-
7java web项目代码不报错但是项目左上角有个红叉之解决
-
8Eclipse中svn资源库中文路径乱码解决
-
9万能方法用指定浏览器打开桌面上的网页快捷方式
-
10论坛注册:用户名包含被系统屏蔽的字符之完美解决
热门排行榜
-
1微信开发errcode:45015,errmsg:response out of time limit之完美解决
-
2archive is not a ZIP archive之解决
-
3火狐每次启动都弹出迅雷提示下载openh264之解决
-
4Eclipse中提示Could not find the main class之解决
-
5以小米6为例图说安卓手机如何安装谷歌四件套
-
6XML document structures must start and end within the same entity报错解决
-
7在微信中调用外部浏览器实现文件下载之解决
-
8U盘安装CentOS 7终极方案,简单有效
-
9POI合并单元格时CellRangeAddress类提示过时之解决
-
10java web项目代码不报错但是项目左上角有个红叉之解决