我正在使用clojure rethinkdb库https://github.com/apa512/clj-rethinkdb - 这是我的连接片段:
(ns rethink.core
(:require
[environ.core]
[cheshire.core :as json]
[org.httpkit.client :as http]
[rethinkdb.query :as r]))
(defn rethink-connect
[]
(r/connect :host (environ.core/env :rethinkdb-host)
:port (environ.core/env :rethinkdb-port)
:db (environ.core/env :rethinkdb-db)
:auth-key (environ.core/env :rethinkdb-auth)))
(defn record-event!
[event collection]
(let [r (with-open [conn (rethink-connect)]
(-> (r/table collection)
(r/insert [event])
(r/run conn)))]))
但我一直收到错误:
clojure.lang.ExceptionInfo: Error connecting to RethinkDB database
core.clj:4617 clojure.core/ex-info
core.clj:4617 clojure.core/ex-info
core.clj:88 rethinkdb.core/connect
core.clj:43 rethinkdb.core/connect
RestFn.java:619 clojure.lang.RestFn.invoke
core.clj:10 rethink.core/rethink-connect
core.clj:8 rethink.core/rethink-connect
core.clj:17 rethink.core/record-event!
core.clj:15 rethink.core/record-event!
core.clj:23 webhook.core/record-event!
core.clj:21 webhook.core/record-event!
handler.clj:11 webhook.handler/webhook-post
handler.clj:8 webhook.handler/webhook-post
handler.clj:9 app.handler/fn
handler.clj:9 app.handler/fn
core.clj:135 compojure.core/make-route[fn]
core.clj:122 compojure.core/wrap-route-middleware[fn]
core.clj:126 compojure.core/wrap-route-info[fn]
core.clj:45 compojure.core/if-route[fn]
core.clj:27 compojure.core/if-method[fn]
core.clj:151 compojure.core/routing[fn]
core.clj:2592 clojure.core/some
core.clj:2583 clojure.core/some
core.clj:151 compojure.core/routing
core.clj:148 compojure.core/routing
RestFn.java:139 clojure.lang.RestFn.applyTo
core.clj:648 clojure.core/apply
core.clj:641 clojure.core/apply
core.clj:156 compojure.core/routes[fn]
keyword_params.clj:35 ring.middleware.keyword-params/wrap-keyword-params[fn]
params.clj:64 ring.middleware.params/wrap-params[fn]
absolute_redirects.clj:38 ring.middleware.absolute-redirects/wrap-absolute-redirects[fn]
content_type.clj:30 ring.middleware.content-type/wrap-content-type[fn]
default_charset.clj:26 ring.middleware.default-charset/wrap-default-charset[fn]
not_modified.clj:52 ring.middleware.not-modified/wrap-not-modified[fn]
Var.java:379 clojure.lang.Var.invoke
reload.clj:22 ring.middleware.reload/wrap-reload[fn]
stacktrace.clj:23 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:86 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
jetty.clj:20 ring.adapter.jetty/proxy-handler[fn]
(Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$ff19274a.handle
HandlerWrapper.java:116 org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:369 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:486 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:944 org.eclipse.jetty.server.AbstractHttpConnection.content
AbstractHttpConnection.java:1005 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content
HttpParser.java:865 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:240 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:82 org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:668 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:52 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:608 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:543 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:745 java.lang.Thread.run
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character
RT.java:1177 clojure.lang.RT.intCast
tcp.clj:156 aleph.tcp/client
tcp.clj:126 aleph.tcp/client
core.clj:61 rethinkdb.core/connect
我从compose.io rethinkdb实例获取主机“aws-us-xxx-1-portal.xxx.xxxx.com”,端口“15731”,db“dev”和auth-key。 auth-key是从compose.io接口提供的身份验证凭据中获取的管理员密码。不知道发生了什么。
答案 0 :(得分:1)
实际上,我还需要使用:ca-cert
参数,证书是从compose.io网络界面提供的。