carmine-sentinel.core documentation

add-sentinel-groups!

(add-sentinel-groups! conf)
Add sentinel groups,it will be merged into current conf:
 {:group-name {:specs  [{ :host host
                        :port port
                        :password password
                        :timeout-ms timeout-ms },
                        ...other sentinel instances...]
               :pool {<opts>}}}
The conf is a map of sentinel group to connection spec.

get-sentinel-redis-spec

(get-sentinel-redis-spec sg master-name {:keys [prefer-slave? slaves-balancer], :or {prefer-slave? false, slaves-balancer first}, :as opts})
Get redis spec by sentinel-group and master name.
If it is not resolved, it will query from sentinel and
cache the result in memory.
Recommend to call this function at your app startup  to reduce
resolving cost.

notify-event-listeners

(notify-event-listeners event)

register-listener!

(register-listener! listener)
Register listener for switching master.
The listener will be called with an event:
  {:event "+switch-master"
   :old {:host old-master-ip
         :port old-master-port
   :new {:host new-master-ip
         :port new-master-port}}}

remove-last-resolved-spec!

(remove-last-resolved-spec! sg master-name)
Remove last resolved master spec by sentinel group and master name.

remove-sentinel-group!

(remove-sentinel-group! group-name)
Remove a sentinel group configuration by name.

sentinel-get-master-addr-by-name

(sentinel-get-master-addr-by-name name)
SENTINEL get-master-addr-by-name name

get master address by master name..

Available since: .

Time complexity: O(1)

sentinel-sentinels

(sentinel-sentinels name)
SENTINEL sentinels name

get sentinel instances by mater name..

Available since: .

Time complexity: O(1)

sentinel-slaves

(sentinel-slaves name)
SENTINEL slaves name

get slaves address by master name..

Available since: .

Time complexity: O(1)

set-sentinel-groups!

(set-sentinel-groups! conf)
Configure sentinel groups, it will replace current conf:
 {:group-name {:specs  [{ :host host
                        :port port
                        :password password
                        :timeout-ms timeout-ms },
                       ...other sentinel instances...]
               :pool {<opts>}}}
The conf is a map of sentinel group to connection spec.

sync-on

macro

(sync-on sg mn & body)

unregister-listener!

(unregister-listener! listener)
Remove the listener for switching master.

update-conn-spec

(update-conn-spec conn)
Cast a carmine-sentinel conn to carmine raw conn spec.
It will resolve master from sentinel first time,then cache the result in
memory for reusing.

wcar

macro

(wcar conn :as-pipeline & body)(wcar conn & body)
It's the same as taoensso.carmine/wcar, but supports
   :master-name "mymaster"
   :sentinel-group :default
in conn for redis sentinel cluster.