Kaynağa Gözat

Merge pull request #4991 from k32/dev/rlog0

feat(rlog): Add RLOG to EMQX
k32 4 yıl önce
ebeveyn
işleme
06dd83c171

+ 1 - 0
.gitignore

@@ -47,3 +47,4 @@ dist.zip
 scripts/git-token
 etc/*.seg
 _upgrade_base/
+TAGS

+ 1 - 1
apps/emqx/rebar.config

@@ -13,7 +13,7 @@
     , {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}}
     , {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.8.2"}}}
     , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.8.0"}}}
-    , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.9.0"}}}
+    , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.10.0"}}}
     , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
     , {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v4.0.1"}}} %% todo delete when plugins use hocon
     , {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.5.0"}}}

+ 5 - 0
apps/emqx/src/emqx_app.erl

@@ -24,8 +24,12 @@
         , get_release/0
         ]).
 
+-include("emqx.hrl").
+
 -define(APP, emqx).
 
+-define(EMQX_SHARDS, []).
+
 -include("emqx_release.hrl").
 
 %%--------------------------------------------------------------------
@@ -39,6 +43,7 @@ start(_Type, _Args) ->
     %% Load application first for ekka_mnesia scanner
     _ = load_ce_modules(),
     ekka:start(),
+    ok = ekka_rlog:wait_for_shards(?EMQX_SHARDS, infinity),
     {ok, Sup} = emqx_sup:start_link(),
     ok = start_autocluster(),
     ok = emqx_plugins:init(),

+ 7 - 0
apps/emqx/src/emqx_schema.erl

@@ -60,6 +60,7 @@ fields("cluster") ->
     , {"dns", ref("dns")}
     , {"etcd", ref("etcd")}
     , {"k8s", ref("k8s")}
+    , {"rlog", ref("rlog")}
     ];
 
 fields("static") ->
@@ -98,6 +99,12 @@ fields("k8s") ->
     , {"suffix", t(string(), undefined, "")}
     ];
 
+fields("rlog") ->
+    [ {"backend", t(union([mnesia, rlog]), "ekka.db_backend", mnesia)}
+    , {"role", t(union([core, replicant]), "ekka.node_role", core)}
+    , {"core_nodes", t(comma_separated_list(), "ekka.core_nodes", [])}
+    ];
+
 fields("node") ->
     [ {"name", t(string(), "vm_args.-name", "emqx@127.0.0.1", "NODE_NAME")}
     , {"ssl_dist_optfile", t(string(), "vm_args.-ssl_dist_optfile", undefined)}

+ 1 - 1
rebar.config

@@ -39,7 +39,7 @@
     , {jiffy, {git, "https://github.com/emqx/jiffy", {tag, "1.0.5"}}}
     , {cowboy, {git, "https://github.com/emqx/cowboy", {tag, "2.8.2"}}}
     , {esockd, {git, "https://github.com/emqx/esockd", {tag, "5.8.0"}}}
-    , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.9.0"}}}
+    , {ekka, {git, "https://github.com/emqx/ekka", {tag, "0.10.0"}}}
     , {gen_rpc, {git, "https://github.com/emqx/gen_rpc", {tag, "2.5.1"}}}
     , {cuttlefish, {git, "https://github.com/emqx/cuttlefish", {tag, "v4.0.1"}}} % TODO: delete when all apps moved to hocon
     , {minirest, {git, "https://github.com/emqx/minirest", {tag, "0.3.5"}}}