java项目启动报错

这个项目需要连接三个数据库,分别是mysql,mongo,redis,
mysql,mongo主要记录,其中redis是做缓存用

在启动的时候报错如下
ConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
2018-11-28 20:21:49,523 [main] INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor - Shutting down ExecutorService ‘clientOutboundChannelExecutor’
2018-11-28 20:21:49,523 [main] INFO org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor - Shutting down ExecutorService ‘clientInboundChannelExecutor’
2018-11-28 20:21:49,526 [main] INFO org.mongodb.driver.connection - Closed connection [connectionId{localValue:2, serverValue:604}] to 172.31.30.66:27017 because the pool has been closed.
2018-11-28 20:21:49,552 [main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit ‘default’
2018-11-28 20:21:49,563 [main] INFO org.apache.catalina.core.StandardService - Stopping service [Tomcat]
2018-11-28 20:21:49,580 [main] INFO org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer -

java项目启动报错

解决方案

这个报错主要的原因就是服务的内网无法联通,导致项目链接redis的时候失败,项目无法启动
处理方法,将项目配置文件的redis ip修改成外网ip,重启即可。同时也需要上控制台检查一下服务器之间是否开放对应的端口,服务器之间如果走的是内网可以忽略。
检查内网之间是否可以正常通信,ping 一下ip 就可以,能ping通说明,服务器内网是互通的。否则则不通。