大家好:
我在虚拟机中安装了一台redis
,并运行了起来。虚拟机的地址是 192.168.56.101
.
之后我在我的真机上写了一个clojure
的程序,使用了ptaoussanis/carmine
来链接虚拟机中的 redis
.
代码如下:
(require '[taoensso.carmine :as car :refer (wcar)])
(def test-redis {:pool {} :spec {:host "192.168.56.101" :port 6379}})
(wcar test-redis (car/lpop "logstash-testlog")) ;logstash-testlog 是 redis 中的 key
但是提示
NoRouteToHostException 没有到主机的路由 java.net.PlainSocketImpl.socketConnect (PlainSocketImpl.java:-2)
怪我咯2017-04-24 09:12:41
This doesn’t seem to have anything to do with clojure. Please try pinging your virtual machine. It should be impossible to connect. When you first start trying new things, it may be best not to use multiple ones at the same time. Try installing redis directly on your host, not through a virtual machine.