数据库 - redis clojure 新手问题
阿神
阿神 2017-04-24 09:10:41
0
2
626

大家好:

我在虚拟机中安装了一台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)
阿神
阿神

闭关修行中......

reply all(2)
PHPzhong

Haha, it turns out that the virtual machine’s iptables doesn’t matter~

刘奇

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template