This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-29
Channels
- # aleph (5)
- # announcements (2)
- # bangalore-clj (2)
- # beginners (52)
- # cider (10)
- # cljsrn (1)
- # clojure (160)
- # clojure-dev (24)
- # clojure-europe (3)
- # clojure-france (1)
- # clojure-india (1)
- # clojure-italy (3)
- # clojure-nl (6)
- # clojure-spec (13)
- # clojure-uk (51)
- # clojurescript (45)
- # code-reviews (1)
- # core-async (41)
- # cursive (41)
- # datomic (17)
- # emacs (37)
- # fulcro (42)
- # graphql (7)
- # joker (4)
- # music (1)
- # nrepl (2)
- # off-topic (21)
- # pathom (19)
- # pedestal (12)
- # re-frame (48)
- # reitit (6)
- # rewrite-clj (8)
- # shadow-cljs (41)
- # specter (6)
- # sql (21)
- # tools-deps (8)
- # vim (7)
- # xtdb (27)
@hoppy not "handy" but I can accelerate our release plan a little 🙂 which backend DB are you hoping to use?
@hoppy some pointers: https://github.com/juxt/crux/blob/master/crux-test/test/crux/jdbc_test.clj
I'm basically hunting the recipe that aligns with the start-standalone-node / start-cluster-node thingy. I can puzzle through that and see how to do it eventually.
@hoppy this seems to work:
(ns crux-jdbc-example
(:require [crux.api :as crux])
(:import (crux.api Crux ICruxAPI)))
(def opts {:dbtype "postgresql"
:port 5432
:dbname "postgres"
:user "postgres"
:kv-backend "crux.kv.memdb.MemKv"
:db-dir "kv-store"})
(def node (Crux/startJDBCNode opts))
in conjunction with running the standard postgres docker image using docker run -p 5432:5432 postgres
I can't see an obvious reason why reusing an existing db within a running instance would be a bad idea, as long as you have plenty of headroom for the storage of backups -- but I'm not a database operations expert 🙂
I'm wanting to do that (move in) because I have a hybrid situation and I wan't a singular consistent backup story
I've surmised that if I completely wipe the rocks stuff, it will rebuild itself, is that correct?
Cool, yeah the sweet spot for JDBC mode is that it fits into an existing ops landscape very trivially
I wouldn't necessarily plan on doing that too much given the time it takes to rebuild will only increase, but I'm guessing you don't have huge quantities of data
so the other fun question. what if the kv store is older than the database backup. Does it "catch up" or is that a nuclear event
aka, my strategy is to not care about the kv store aside from say, back it up once a month.
yep it catches up, regardless of how old it is, and that's the basis of how clustering works with each node continuously trying to stay up to date with transaction log independently
Is there a way to block until a submit-tx
completes?
(let [id (m/random-uuid)]
(crux/submit-tx node [[:crux.tx/put {:crux.db/id id}]])
;;??
(crux/entity (crux/db node) id)) ;;how to make this return the submitted entity
Here we go, working:
(let [id (m/random-uuid)]
(let [result (crux/submit-tx node [[:crux.tx/put {:crux.db/id id}]])]
(crux/sync node (:crux.tx/tx-time result) (Duration/parse "pt1s")))
(crux/entity (crux/db node) id))
@taylor.jeremydavid the above sorta works (the first time).
@U050DD55V any advice on how this should be handled?
the create-table should be idempotent - i.e. create table if not exists, so should be ok to be called. if there is a bug / problem then please raise and we'll fix
I retried this with master last night. It seems that the sql for has been updated there, so it is working now.
I retried this with master last night. It seems that the sql for has been updated there, so it is working now.