每当我在本地机器之外运行我的代码时,我都被连接错误困扰了一周。
连接错误是因为无论我做什么,胭脂红都连接到本地主机。这是来自我的 ns 的 repl 会话的完整输出store.core
,其中require
s [taoensso.carmine :as redis]
:
(def conn
{:pool {}
:spec {:url "redis://redistogo:[password]@chubb.redistogo.com:9836/"}})
#'store.core/conn
store.core=> (redis/wcar conn (redis/hget 1 2))
java.net.ConnectException: Connection refused (Connection refused)
clojure.lang.ExceptionInfo: Carmine connection error
[在另一个终端启用本地 redis]
store.core=> (redis/wcar conn (redis/hget 1 2))
"3"
^ this is now connecting to my local redis, despite `conn` pointing to redistogo.
我究竟做错了什么?这种用法似乎与carmine.clj#L28建议的完全一样!