fabric-ca-server 配置mysql数据库,区块链(4)
配置文件
找到fabric-ca-sever服务:
进入docker容器:
[root@VM_0_6_centos ~]# docker exec -it ca_peerOrg1 bash
找到配置文件:
copy出文件:
[root@VM_0_6_centos ~]# docker cp **dockerid**:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml fabric-ca-server-config.yaml
dockerid 根据你的dockerid 而定
编辑文件:
db:
type: mysql
datasource: root:rootpwd@tcp(***.**.**.***:3306)/fabric_ca?parseTime=true
tls:
enabled: false
certfiles:
client:
certfile:
keyfile:
root,rootpwd 分别为用户名和密码
将文件copy回去
[root@VM_0_6_centos ~]# docker cp fabric-ca-server-config.yaml 60df7ea8013e:/etc/hyperledger/fabric-ca-server/fabric-ca-server-config.yaml
重启容器
[root@VM_0_6_centos ~]# docker restart ca_peerOrg1
查看数据库:
设置完成:
但是我们是docker 启动这个里面是没有用户的,现在我们初始化用户
进入容器:
[root@VM_0_6_centos ~]# docker exec -it ca_peerOrg1 bash
root@60df7ea8013e:/etc/hyperledger# cd /etc/hyperledger
root@60df7ea8013e:/etc/hyperledger# fabric-ca-server init -b admin:adminpw
用户初始化成功
下面我们可以进行注册,需要的是代码操作,这个地方不过多的叙述
如果在注册过程中创建索引失败:
[Err] 1709 - Index column size too large. The maximum column size is 767 bytes.
可以借助这篇文章进行解决:
https://blog.csdn.net/li66934791/article/details/85296551
希望对你有所帮助
个人网站:www.read8686.com
还没有评论,来说两句吧...