diff --git a/.ci/docker-compose-file/docker-compose-emqx-cluster-mnesia.override.yaml b/.ci/docker-compose-file/docker-compose-emqx-cluster-mnesia.override.yaml new file mode 100644 index 000000000..1a255b2e1 --- /dev/null +++ b/.ci/docker-compose-file/docker-compose-emqx-cluster-mnesia.override.yaml @@ -0,0 +1,29 @@ +x-default-emqx: &default-emqx + env_file: + - conf.cluster.env + healthcheck: + test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"] + interval: 5s + timeout: 25s + retries: 5 + +services: + emqx1: + <<: *default-emqx + container_name: node1.emqx.io + restart: on-failure + environment: + - "EMQX_HOST=node1.emqx.io" + - "EMQX_DB__BACKEND=mnesia" + - "EMQX_DB__ROLE=core" + + emqx2: + <<: *default-emqx + container_name: node2.emqx.io + depends_on: + - emqx1 + restart: on-failure + environment: + - "EMQX_HOST=node2.emqx.io" + - "EMQX_DB__BACKEND=mnesia" + - "EMQX_DB__ROLE=core" diff --git a/.ci/docker-compose-file/scripts/run-emqx.sh b/.ci/docker-compose-file/scripts/run-emqx.sh index 60946badb..bf99cb61f 100755 --- a/.ci/docker-compose-file/scripts/run-emqx.sh +++ b/.ci/docker-compose-file/scripts/run-emqx.sh @@ -5,12 +5,18 @@ set -euxo pipefail export _EMQX_DOCKER_IMAGE_TAG="$1" _EMQX_TEST_DB_BACKEND="${2:-${_EMQX_TEST_DB_BACKEND:-mnesia}}" -if [ "$_EMQX_TEST_DB_BACKEND" = "rlog" ] -then - CLUSTER_OVERRIDES="-f .ci/docker-compose-file/docker-compose-emqx-cluster-rlog.override.yaml" -else - CLUSTER_OVERRIDES="" -fi +case "$_EMQX_TEST_DB_BACKEND" in + rlog) + CLUSTER_OVERRIDES=".ci/docker-compose-file/docker-compose-emqx-cluster-rlog.override.yaml" + ;; + mnesia) + CLUSTER_OVERRIDES=".ci/docker-compose-file/docker-compose-emqx-cluster-mnesia.override.yaml" + ;; + *) + echo "ERROR: Unknown DB backend: ${_EMQX_TEST_DB_BACKEND}" + exit 1 + ;; +esac { echo "HOCON_ENV_OVERRIDE_PREFIX=EMQX_" @@ -39,10 +45,9 @@ is_cluster_up() { is_node_listening node2.emqx.io } -# shellcheck disable=SC2086 docker-compose \ -f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \ - $CLUSTER_OVERRIDES \ + -f "$CLUSTER_OVERRIDES" \ -f .ci/docker-compose-file/docker-compose-python.yaml \ up -d diff --git a/apps/emqx_conf/src/emqx_conf_schema.erl b/apps/emqx_conf/src/emqx_conf_schema.erl index 5dd07ce6c..cc97830fd 100644 --- a/apps/emqx_conf/src/emqx_conf_schema.erl +++ b/apps/emqx_conf/src/emqx_conf_schema.erl @@ -362,11 +362,12 @@ fields("db") -> [ {"backend", sc(hoconsc:enum([mnesia, rlog]), #{ mapping => "mria.db_backend" - , default => mnesia + , default => rlog , desc => """ Select the backend for the embedded database.
-mnesia is the default backend, that offers decent performance in small clusters.
-rlog is a new experimental backend that is suitable for very large clusters. +rlog is the default backend, a new experimental backend +that is suitable for very large clusters.
+mnesia is a backend that offers decent performance in small clusters. """ })} , {"role", @@ -391,7 +392,10 @@ to rlog. , desc => """ List of core nodes that the replicant will connect to.
Note: this parameter only takes effect when the backend is set -to rlog and the role is set to replicant. +to rlog and the role is set to replicant.
+This values needs to be defined for manual or static cluster discovery mechanisms.
+If an automatic cluster discovery mechanism is being used (such as etcd), +there is no need to set this value. """ })} , {"rpc_module",