压缩文件;以备拉取压缩包
sudo tar cvfz fabric-samples.tgz fabric-samples
(前一个fabric-samples代表压缩后压缩包名;后一个tabric-samples代表要压缩的文件名)
启动区块链 需要先找到链所在的目录;然后输入一下代码
~/fabric-samples/fabcar$ ./startFabric.sh
判断链是否在运行
docker ps
apt 的作用是安装软件的关键字
Error while registering the user org.example.RegisterUser$1@4152d38d url: https://192.168.123.61:7054 POST request to https://192.168.123.61:7054 failed request body {"id":"appUser","type":"client","affiliation":"org1.department1","attrs":[]}. Response: {"result":"","errors":[{"code":0,"message":"Registration of 'appUser' failed: Identity 'appUser' is already registered"}
],"messages":[],"success":false}
当客户端第二次申请注册用户时;并且申请的用户名一样(这里时appUser)时会报异常,更改一下用户名就可以解决
注册信息时;数据库中会有一个状态码 1/0;正常注册时,状态是1,如果注册过程中出现异常可能会导致状态是0,去ca库中 把user表和certificates表中删除掉已经注册过的用户信息(两个表都需要删除掉)然后;重新注册即可
打开ca库并查看表结构
docker exec -it ca_org1 bash
进入etc/hyperledger并查看结构目录
cd /etc/hyperledger/
cd fabric-ca-server/
安装sqlite
apt-get install sqlite3
sqlite3 fabric-ca-server.db
查看表结构
.tables
# 查看用户
select *from users;
删除证书并更新查看
delete from certificates where id='appUser2';
update users set state=0 where id='appUser2';
select *from users;
跟踪日志输出
docker logs -f ca_org1
docker exec -it ca_org1 bash
sqlite3 fabric-ca-server.db
delete from certificaates where id='appUser2';
cd /etc/hyperledger/fabric-ca-server/
sqlite3 fabric-ca-server.db
.tables
select * from users;