Java_Explorer 提出了问题 · 2020-08-23
搭建fabric kafka集群,3个order、3个zookeeper、4个kafka、2个peer。
peer0创建channel,安装并初始化chaincode成功,但是在peer1上执行下面命令:peer chaincode invoke --tls --cafile $ORDERER_CA -C mychannel -n mycc -c '{"Args":["invoke","a","b","20"]}'
报错如下:Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode mycc has been successfully instantiated and try again: chaincode mycc not found"
在peer0上执行是没有问题的。
尝试在peer1上创建channel,报错如下:Error: timeout waiting for channel creation
请问该如何解决呢?
搭建fabric kafka集群,3个order、3个zookeeper、4个kafka、2个peer。peer0创建channel,安装并初始化chaincode成功,但是在peer1上执行下面命令:
关注 1回答 0
Java_Explorer 提出了问题 · 2020-08-03
搭建fabric集群,版本1.4.8,采用solo模式的4+1的架构:1 Order,4 Peer,启动报错如下:peer0.org1.example.com | 2020-08-03 02:03:55.368 UTC [core.comm] ServerHandshake -> ERRO 0d5 TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59870
peer0.org1.example.com | 2020-08-03 02:03:56.368 UTC [core.comm] ServerHandshake -> ERRO 0d6 TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59872
peer0.org1.example.com | 2020-08-03 02:03:58.273 UTC [core.comm] ServerHandshake -> ERRO 0d7 TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59874
peer0.org1.example.com | 2020-08-03 02:04:19.991 UTC [gossip.discovery] func1 -> WARN 0d8 Could not connect to Endpoint: peer1.org1.example.com:7051, InternalEndpoint: peer1.org1.example.com:7051, PKI-ID: , Metadata: : context deadline exceeded
peer0.org1.example.com | 2020-08-03 02:04:23.372 UTC [core.comm] ServerHandshake -> ERRO 0d9 TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59876
peer0.org1.example.com | 2020-08-03 02:04:24.374 UTC [core.comm] ServerHandshake -> ERRO 0da TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59878
peer0.org1.example.com | 2020-08-03 02:04:25.811 UTC [core.comm] ServerHandshake -> ERRO 0db TLS handshake failed with error remote error: tls: bad certificate server=PeerServer remoteaddress=192.168.133.113:59880
这是什么原因,如何解决?
搭建fabric集群,版本1.4.8,采用solo模式的4+1的架构:1 Order,4 Peer,启动报错如下: {代码...} 这是什么原因,如何解决?
关注 2回答 1
Java_Explorer 赞了回答 · 2019-08-31
因为commons-dbcp的声明被覆盖了。
你理解的前面的覆盖后面其实是间接依赖的原则。
A -> Y(1.0),B -> Y(2.0),Y(1.0)和Y(2.0)的依赖路径长度相同,如果A的声明在B之前,那么Y(1.0)会被解析使用。
因为commons-dbcp的声明被覆盖了。你理解的前面的覆盖后面其实是间接依赖的原则。 A -> Y(1.0),B -> Y(2.0),Y(1.0)和Y(2.0)的依赖路径长度相同,如果A的声明在B之前,那么Y(1.0)会被解析使用。
关注 2回答 1
Java_Explorer 提出了问题 · 2019-08-29
Maven项目引入两个jar包,groupId和artifactId相同,version不同。
commons-dbcp
commons-dbcp
1.4
commons-dbcp
commons-dbcp
1.2
根据Maven的依赖规则,应该是前面覆盖后面的,可是为什么最终依赖的是1.2,而不是1.4?
Maven项目引入两个jar包,groupId和artifactId相同,version不同。 {代码...} 根据Maven的依赖规则,应该是前面覆盖后面的,可是为什么最终依赖的是1.2,而不是1.4?
关注 2回答 1
Java_Explorer 回答了问题 · 2019-07-25
覆盖索引,如果加个字段f_4就不会走索引了。
覆盖索引,如果加个字段f_4就不会走索引了。
关注 2回答 2
Java_Explorer 提出了问题 · 2019-07-25
建表语句:CREATE TABLE `t_1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`f_1` varchar(255) DEFAULT NULL,
`f_2` varchar(255) DEFAULT NULL,
`f_3` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_fh` (`f_1`,`f_2`,`f_3`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
索引index_fh是f_1、f-2、f_3三个字段创建的联合索引。
根据最左匹配原则,select * from abcd where f_1 = '1';
select * from abcd where f_1 = '1' and f_2 = '1';
select * from abcd where f_1 = '1' and f_2 = '1' and f_3 = '1';
上面三个sql语句会使用索引index_fh。
但是select * from abcd where f_2 = '1';
select * from abcd where f_3 = '1';
select * from abcd where f_2 = '1' and f_3 = '1';
应该不会使用索引,可是使用explain查看查询计划,仍然使用了索引。+------+-------------+-------+-------+---------------+----------+---------+------+------+--------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+-------+---------------+----------+---------+------+------+--------------------------+
| 1 | SIMPLE | t_1 | index | NULL | index_fh | 2304 | NULL | 1 | Using where; Using index |
+------+-------------+-------+-------+---------------+----------+---------+------+------+--------------------------+
建表语句:CREATE TABLE `t_2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`f_1` varchar(255) DEFAULT NULL,
`f_2` varchar(255) DEFAULT NULL,
`f_3` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `index_fh` (`f_2`,`f_3`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
建表语句和上面基本相同,只是索引使用了f_2、f_3两个字段,此时查询语句select * from t_2 where f_3 = '1';
查看查询计划+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
| 1 | SIMPLE | t_2 | ALL | NULL | NULL | NULL | NULL | 4 | Using where |
+------+-------------+-------+------+---------------+------+---------+------+------+-------------+
没有使用索引。
为什么select * from t_2 where f_3 = '1';在两个表中都不符合最左匹配原则,查询时一个使用了索引,一个没使用索引?
建表语句: {代码