关于 YMatrix
部署数据库
使用数据库
管理集群
最佳实践
高级功能
高级查询
联邦查询
Grafana 监控
备份恢复
灾难恢复
图数据库
管理手册
性能调优
故障诊断
工具指南
系统配置参数
SQL 参考
注意!
强烈建议操作前,备份/etc/matrixdb6目录下的配置文件到其他目录或联系 YMatrix 技术人员进行操作。
在升级场景下,在 reinstall 完 YMatrix rpm 包后,需要通过
sudo systemctl restart matrixdb6.supervisor.service命令重启所有节点的 supervisor 服务
1.使用 mxstop -af 关闭数据库集群
2.使用 supervisorctl enable-etcd-credential 启用 TLS 证书
3.使用 mxstart -a 启动数据库集群
etcdctl 命令指定证书执行:
etcdctl --endpoints="$ETCD_ENDPOINTS" \
--cacert "$MXCONFDIR/etcd_credential/ca.crt" \
--cert "$MXCONFDIR/etcd_credential/client.crt" \
--key "$MXCONFDIR/etcd_credential/client.key" \
--write-out=table endpoint status
[mxadmin@ip-172-31-35-209 ~]$ etcdctl --endpoints="https://172.31.35.209:4679,https://172.31.32.54:4679,https://172.31.47.1:4679" \
> --cacert "$MXCONFDIR/etcd_credential/ca.crt" \
> --cert "$MXCONFDIR/etcd_credential/client.crt" \
> --key "$MXCONFDIR/etcd_credential/client.key" \
> --write-out=table endpoint status
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS |
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
| https://172.31.35.209:4679 | 67e0d780ecd95b3b | 3.5.20 | 164 kB | false | false | 4 | 473 | 473 | |
| https://172.31.32.54:4679 | 9c2d17a0b36aed50 | 3.5.20 | 164 kB | true | false | 4 | 473 | 473 | |
| https://172.31.47.1:4679 | 5fa5b306916e2d84 | 3.5.20 | 164 kB | false | false | 4 | 473 | 473 | |
+----------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+
默认配置目录为 /etc/matrixdbX。
grep -n "etcd_endpoints" "/etc/matrixdb6/physical_cluster.toml"
[mxadmin@ip-127-1-1-1 ~]$ grep -n "etcd_endpoints" "/etc/matrixdb6/physical_cluster.toml"
4:etcd_endpoints = ['https://127.1.1.1:4679', 'https://127.1.1.1:4679', 'https://127.1.1.1:4679']
ls -la "/etc/matrixdb6/etcd_credential"
[mxadmin@ip-127-1-1-1 ~]$ ls -la "/etc/matrixdb6/etcd_credential"
total 28
drwx------. 2 mxadmin mxadmin 123 Jan 22 03:26 .
drwxr-xr-x. 6 root root 288 Jan 22 01:52 ..
-rw-------. 1 mxadmin mxadmin 1846 Jan 22 02:47 ca.crt
-rw-------. 1 mxadmin mxadmin 3272 Jan 22 02:47 ca.key
-rw-------. 1 mxadmin mxadmin 1513 Jan 22 02:47 client.crt
-rw-------. 1 mxadmin mxadmin 1708 Jan 22 02:47 client.key
-rw-------. 1 mxadmin mxadmin 407 Jan 22 01:52 meta.json
-rw-------. 1 mxadmin mxadmin 1558 Jan 22 02:47 server.crt
-rw-------. 1 mxadmin mxadmin 1704 Jan 22 02:47 server.key
是否启用判断方法:
TLS 已启用:physical_cluster.toml中endpoints为https://...,且/etcd_credential下存在ca.crt/ca.key/server.crt/server.key/client.crt/client.key等文件。
TLS 未启用:endpoints为http://...,且/etcd_credential不存在。
supervisorctl enable-etcd-credential
supervisorctl enable-etcd-credential --rollback
supervisorctl enable-etcd-credential
命令执行窗口内会停止除 supervisord 外的相关服务,生成 /etcd_credential 下的证书文件,更新 /service/etcd.conf 将 client url 切换为 https:// 并启用 --client-cert-auth,将 physical_cluster.toml 的 endpoints 更新为 https://...,随后统一启动所有服务。
[mxadmin@ip-127-1-1-1 ~]$ supervisorctl enable-etcd-credential
EnableEtcdCredential succeeded.
supervisorctl enable-etcd-credential --rollback
使用场景: 1.启用 TLS 过程中失败并且自动回滚实效,需要恢复到全量 HTTP。 2.已启用 TLS,但需要临时恢复到不带证书的 HTTP。
执行效果:
1.回滚 /service/etcd.conf:移除 TLS 相关参数并将 client url 从 https://`` 改回http://。 2.更新physical_cluster.toml:将endpoints恢复为http://...。 3.清理本机凭据:删除/etcd_credential`。
输出示例:
[mxadmin@ip-127-1-1-1 ~]$ supervisorctl enable-etcd-credential --rollback
EnableEtcdCredential succeeded.