Merge pull request #8056 from thalesmg/move-db-config
chore(config): move db configs under cluster/node keys
This commit is contained in:
commit
d249c2c22e
|
@ -14,8 +14,8 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- "EMQX_HOST=node1.emqx.io"
|
- "EMQX_HOST=node1.emqx.io"
|
||||||
- "EMQX_DB__BACKEND=mnesia"
|
- "EMQX_NODE__DB_BACKEND=mnesia"
|
||||||
- "EMQX_DB__ROLE=core"
|
- "EMQX_NODE__DB_ROLE=core"
|
||||||
|
|
||||||
emqx2:
|
emqx2:
|
||||||
<<: *default-emqx
|
<<: *default-emqx
|
||||||
|
@ -25,5 +25,5 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- "EMQX_HOST=node2.emqx.io"
|
- "EMQX_HOST=node2.emqx.io"
|
||||||
- "EMQX_DB__BACKEND=mnesia"
|
- "EMQX_NODE__DB_BACKEND=mnesia"
|
||||||
- "EMQX_DB__ROLE=core"
|
- "EMQX_NODE__DB_ROLE=core"
|
||||||
|
|
|
@ -14,8 +14,8 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- "EMQX_HOST=node1.emqx.io"
|
- "EMQX_HOST=node1.emqx.io"
|
||||||
- "EMQX_DB__BACKEND=rlog"
|
- "EMQX_NODE__DB_BACKEND=rlog"
|
||||||
- "EMQX_DB__ROLE=core"
|
- "EMQX_NODE__DB_ROLE=core"
|
||||||
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io]"
|
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io]"
|
||||||
- "EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL=false"
|
- "EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL=false"
|
||||||
- "EMQX_LISTENERS__WS__DEFAULT__PROXY_PROTOCOL=false"
|
- "EMQX_LISTENERS__WS__DEFAULT__PROXY_PROTOCOL=false"
|
||||||
|
@ -28,9 +28,9 @@ services:
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
environment:
|
environment:
|
||||||
- "EMQX_HOST=node2.emqx.io"
|
- "EMQX_HOST=node2.emqx.io"
|
||||||
- "EMQX_DB__BACKEND=rlog"
|
- "EMQX_NODE__DB_BACKEND=rlog"
|
||||||
- "EMQX_DB__ROLE=replicant"
|
- "EMQX_NODE__DB_ROLE=replicant"
|
||||||
- "EMQX_DB__CORE_NODES=emqx@node1.emqx.io"
|
- "EMQX_CLUSTER__CORE_NODES=emqx@node1.emqx.io"
|
||||||
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io]"
|
- "EMQX_CLUSTER__STATIC__SEEDS=[emqx@node1.emqx.io]"
|
||||||
- "EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL=false"
|
- "EMQX_LISTENERS__TCP__DEFAULT__PROXY_PROTOCOL=false"
|
||||||
- "EMQX_LISTENERS__WS__DEFAULT__PROXY_PROTOCOL=false"
|
- "EMQX_LISTENERS__WS__DEFAULT__PROXY_PROTOCOL=false"
|
||||||
|
|
|
@ -10,12 +10,12 @@ jobs:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1000
|
fetch-depth: 1000
|
||||||
- name: Check line-break at EOF
|
|
||||||
run: |
|
|
||||||
./scripts/check-nl-at-eof.sh
|
|
||||||
- name: Work around https://github.com/actions/checkout/issues/766
|
- name: Work around https://github.com/actions/checkout/issues/766
|
||||||
run: |
|
run: |
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
- name: Check line-break at EOF
|
||||||
|
run: |
|
||||||
|
./scripts/check-nl-at-eof.sh
|
||||||
- name: Check Elixir code formatting
|
- name: Check Elixir code formatting
|
||||||
run: |
|
run: |
|
||||||
mix format --check-formatted
|
mix format --check-formatted
|
||||||
|
@ -27,4 +27,3 @@ jobs:
|
||||||
- name: Run elvis check
|
- name: Run elvis check
|
||||||
run: |
|
run: |
|
||||||
./scripts/elvis-check.sh $GITHUB_BASE_REF
|
./scripts/elvis-check.sh $GITHUB_BASE_REF
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,20 @@ node {
|
||||||
max_history = 100
|
max_history = 100
|
||||||
cleanup_interval = 5m
|
cleanup_interval = 5m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Database backend
|
||||||
|
##
|
||||||
|
## @doc node.db_backend
|
||||||
|
## ValueType: mnesia | rlog
|
||||||
|
## Default: rlog
|
||||||
|
db_backend = rlog
|
||||||
|
|
||||||
|
## RLOG role
|
||||||
|
##
|
||||||
|
## @doc node.db_role
|
||||||
|
## ValueType: core | replicant
|
||||||
|
## Default: core
|
||||||
|
db_role = core
|
||||||
}
|
}
|
||||||
|
|
||||||
##==================================================================
|
##==================================================================
|
||||||
|
@ -142,6 +156,13 @@ cluster {
|
||||||
## Default: manual
|
## Default: manual
|
||||||
discovery_strategy = manual
|
discovery_strategy = manual
|
||||||
|
|
||||||
|
## Replicant core nodes
|
||||||
|
##
|
||||||
|
## @doc cluster.core_nodes
|
||||||
|
## ValueType: comma-separated node list
|
||||||
|
## Default: ""
|
||||||
|
core_nodes = ""
|
||||||
|
|
||||||
##----------------------------------------------------------------
|
##----------------------------------------------------------------
|
||||||
## Cluster using static node list
|
## Cluster using static node list
|
||||||
##----------------------------------------------------------------
|
##----------------------------------------------------------------
|
||||||
|
@ -311,32 +332,6 @@ cluster {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
##==================================================================
|
|
||||||
## Internal database
|
|
||||||
##==================================================================
|
|
||||||
db {
|
|
||||||
## Database backend
|
|
||||||
##
|
|
||||||
## @doc db.backend
|
|
||||||
## ValueType: mnesia | rlog
|
|
||||||
## Default: rlog
|
|
||||||
backend = rlog
|
|
||||||
|
|
||||||
## RLOG role
|
|
||||||
##
|
|
||||||
## @doc db.role
|
|
||||||
## ValueType: core | replicant
|
|
||||||
## Default: core
|
|
||||||
role = core
|
|
||||||
|
|
||||||
## Replicant core nodes
|
|
||||||
##
|
|
||||||
## @doc db.core_nodes
|
|
||||||
## ValueType: comma-separated node list
|
|
||||||
## Default: ""
|
|
||||||
core_nodes = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
##==================================================================
|
##==================================================================
|
||||||
## Log
|
## Log
|
||||||
##==================================================================
|
##==================================================================
|
||||||
|
|
|
@ -93,11 +93,6 @@ roots() ->
|
||||||
sc(
|
sc(
|
||||||
ref("rpc"),
|
ref("rpc"),
|
||||||
#{translate_to => ["gen_rpc"]}
|
#{translate_to => ["gen_rpc"]}
|
||||||
)},
|
|
||||||
{"db",
|
|
||||||
sc(
|
|
||||||
ref("db"),
|
|
||||||
#{}
|
|
||||||
)}
|
)}
|
||||||
] ++
|
] ++
|
||||||
emqx_schema:roots(medium) ++
|
emqx_schema:roots(medium) ++
|
||||||
|
@ -129,6 +124,16 @@ fields("cluster") ->
|
||||||
'readOnly' => true
|
'readOnly' => true
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
|
{"core_nodes",
|
||||||
|
sc(
|
||||||
|
emqx_schema:comma_separated_atoms(),
|
||||||
|
#{
|
||||||
|
mapping => "mria.core_nodes",
|
||||||
|
default => [],
|
||||||
|
'readOnly' => true,
|
||||||
|
desc => ?DESC(db_core_nodes)
|
||||||
|
}
|
||||||
|
)},
|
||||||
{"autoclean",
|
{"autoclean",
|
||||||
sc(
|
sc(
|
||||||
emqx_schema:duration(),
|
emqx_schema:duration(),
|
||||||
|
@ -509,11 +514,8 @@ fields("node") ->
|
||||||
sc(
|
sc(
|
||||||
ref("cluster_call"),
|
ref("cluster_call"),
|
||||||
#{'readOnly' => true}
|
#{'readOnly' => true}
|
||||||
)}
|
)},
|
||||||
];
|
{"db_backend",
|
||||||
fields("db") ->
|
|
||||||
[
|
|
||||||
{"backend",
|
|
||||||
sc(
|
sc(
|
||||||
hoconsc:enum([mnesia, rlog]),
|
hoconsc:enum([mnesia, rlog]),
|
||||||
#{
|
#{
|
||||||
|
@ -523,7 +525,7 @@ fields("db") ->
|
||||||
desc => ?DESC(db_backend)
|
desc => ?DESC(db_backend)
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"role",
|
{"db_role",
|
||||||
sc(
|
sc(
|
||||||
hoconsc:enum([core, replicant]),
|
hoconsc:enum([core, replicant]),
|
||||||
#{
|
#{
|
||||||
|
@ -533,16 +535,6 @@ fields("db") ->
|
||||||
desc => ?DESC(db_role)
|
desc => ?DESC(db_role)
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
{"core_nodes",
|
|
||||||
sc(
|
|
||||||
emqx_schema:comma_separated_atoms(),
|
|
||||||
#{
|
|
||||||
mapping => "mria.core_nodes",
|
|
||||||
default => [],
|
|
||||||
'readOnly' => true,
|
|
||||||
desc => ?DESC(db_core_nodes)
|
|
||||||
}
|
|
||||||
)},
|
|
||||||
{"rpc_module",
|
{"rpc_module",
|
||||||
sc(
|
sc(
|
||||||
hoconsc:enum([gen_rpc, rpc]),
|
hoconsc:enum([gen_rpc, rpc]),
|
||||||
|
@ -933,8 +925,6 @@ desc(cluster_k8s) ->
|
||||||
?DESC("desc_cluster_k8s");
|
?DESC("desc_cluster_k8s");
|
||||||
desc("node") ->
|
desc("node") ->
|
||||||
?DESC("desc_node");
|
?DESC("desc_node");
|
||||||
desc("db") ->
|
|
||||||
?DESC("desc_db");
|
|
||||||
desc("cluster_call") ->
|
desc("cluster_call") ->
|
||||||
?DESC("desc_cluster_call");
|
?DESC("desc_cluster_call");
|
||||||
desc("rpc") ->
|
desc("rpc") ->
|
||||||
|
|
8
bin/emqx
8
bin/emqx
|
@ -406,7 +406,7 @@ call_hocon() {
|
||||||
## Resolve boot configs in a batch
|
## Resolve boot configs in a batch
|
||||||
## This is because starting the Erlang beam with all modules loaded
|
## This is because starting the Erlang beam with all modules loaded
|
||||||
## and parsing HOCON config + environment variables is a non-trivial task
|
## and parsing HOCON config + environment variables is a non-trivial task
|
||||||
CONF_KEYS=( 'node.data_dir' 'node.name' 'node.cookie' 'db.backend' )
|
CONF_KEYS=( 'node.data_dir' 'node.name' 'node.cookie' 'node.db_backend' )
|
||||||
if [ "$IS_ENTERPRISE" = 'yes' ]; then
|
if [ "$IS_ENTERPRISE" = 'yes' ]; then
|
||||||
CONF_KEYS+=( 'license.file' 'license.key' )
|
CONF_KEYS+=( 'license.file' 'license.key' )
|
||||||
fi
|
fi
|
||||||
|
@ -718,11 +718,11 @@ fi
|
||||||
|
|
||||||
## check if OTP version has mnesia_hook feature; if not, fallback to
|
## check if OTP version has mnesia_hook feature; if not, fallback to
|
||||||
## using Mnesia DB backend.
|
## using Mnesia DB backend.
|
||||||
if [[ "$IS_BOOT_COMMAND" == 'yes' && "$(get_boot_config 'db.backend')" == "rlog" ]]; then
|
if [[ "$IS_BOOT_COMMAND" == 'yes' && "$(get_boot_config 'node.db_backend')" == "rlog" ]]; then
|
||||||
if ! (echo -e "$COMPATIBILITY_INFO" | grep -q 'MNESIA_OK'); then
|
if ! (echo -e "$COMPATIBILITY_INFO" | grep -q 'MNESIA_OK'); then
|
||||||
echoerr "DB Backend is RLOG, but an incompatible OTP version has been detected. Falling back to using Mnesia DB backend."
|
echoerr "DB Backend is RLOG, but an incompatible OTP version has been detected. Falling back to using Mnesia DB backend."
|
||||||
export EMQX_DB__BACKEND=mnesia
|
export EMQX_NODE__DB_BACKEND=mnesia
|
||||||
export EMQX_DB__ROLE=core
|
export EMQX_NODE__DB_ROLE=core
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -64,8 +64,8 @@
|
||||||
@set node_type=-name
|
@set node_type=-name
|
||||||
@set schema_mod=emqx_conf_schema
|
@set schema_mod=emqx_conf_schema
|
||||||
:: no advanced DB backend for Windows
|
:: no advanced DB backend for Windows
|
||||||
@set EMQX_DB__BACKEND=mnesia
|
@set EMQX_NODE__DB_BACKEND=mnesia
|
||||||
@set EMQX_DB__ROLE=core
|
@set EMQX_NODE__DB_ROLE=core
|
||||||
|
|
||||||
@set conf_path="%etc_dir%\emqx.conf"
|
@set conf_path="%etc_dir%\emqx.conf"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue