4. 配置变更
4.1. 简介
ChainMaker在部署完成后,默认生成的链配置文件目录为:安装目录/config/orgid/chainconfig/bcx.yml,文件名bcx.ym代表链id。在ChainMker启动时会使用链配置文件生成创世配置块,后续如果想更改链配置就需要使用动态配置更改的方式进行。
4.2. 配置更改的方式
当前链配置的更改可以使用ChainMaker的命令行工具cmc进行,当前cmc支持的链配置功能有限,更多配置的更改需要使用chainmaker的go语言或java语言的sdk编写客户端代码进行更改。具体参考
4.3. 使用命令行工具修改链配置
查询链配置
./cmc client chainconfig query \
--sdk-conf-path=./testdata/sdk_config.yml \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key
更新区块出块时间
./cmc client chainconfig block updateblockinterval \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--block-interval 1000
增加组织根证书
./cmc client chainconfig trustroot add \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--trust-root-org-id=wx-org5.chainmaker.org \
--trust-root-path=./testdata/crypto-config/wx-org5.chainmaker.org/ca/ca.crt
删除组织根证书
./cmc client chainconfig trustroot add \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--trust-root-org-id=wx-org5.chainmaker.org \
--trust-root-path=./testdata/crypto-config/wx-org5.chainmaker.org/ca/ca.crt
升级组织根证书
./cmc client chainconfig trustroot add \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--trust-root-org-id=wx-org5.chainmaker.org \
--trust-root-path=./testdata/crypto-config/wx-org5.chainmaker.org/ca/ca.crt
添加共识节点
./cmc client chainconfig consensusnode add \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--node-id=QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC4 \
--node-org-id=wx-org1.chainmaker.org
删除共识节点
./cmc client chainconfig consensusnode remove \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--node-id=QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC4 \
--node-org-id=wx-org1.chainmaker.org
升级共识节点
./cmc client chainconfig consensusnode update \
--org-id=wx-org1.chainmaker.org \
--client-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.crt \
--client-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/client1/client1.tls.key \
--sdk-conf-path=./testdata/sdk_config.yml \
--admin-crt-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.crt \
--admin-key-file-paths=./testdata/crypto-config/wx-org1.chainmaker.org/user/admin1/admin1.tls.key \
--node-id=QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC5 \
--node-id-old=QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC4 \
--node-org-id=wx-org1.chainmaker.org