diff --git a/distributed-deploy/README.md b/distributed-deploy/README.md index 5ab0e88b..bb5cff44 100644 --- a/distributed-deploy/README.md +++ b/distributed-deploy/README.md @@ -1,8 +1,10 @@ # Introduction -This project is aimed to automate the deployment process of the hyperledger fabric。Hyperledger Fabric is a platform for distributed ledger solutions and the examples released can easily deploy the Hyperledger Fabric network in a standalone machine environment ,including order, peer chaincode and so on。However, If you want to build up the Hyperledger Fabric network in the distributing development environments, it is not a easy task and you have to deploy the modules in each of the machine manually, which is including lots of configurations and commands and inconvenient。Our preject is a tool to help you to install the hyperledger fabric in the distributing development environments easily and conveniently. +This project is aimed to automate the deployment process of the hyperledger fabric. Hyperledger Fabric is a platform for distributed ledger solutions and the examples released can easily deploy the Hyperledger Fabric network in a standalone machine environment, including order, peer chaincode and so on. -The deployment tool provides basic mechanisms for deployment, repairment, and scaling of applications. Firstly, once you have completed the configuration of the orderer and peer,witch include the information of the role,the domain and ip address,the tool can deploy the orderer and the peer according the configuration you written by itself;Secondly, when the hyperledger fabric network is running,the tool can scale your hyperledger fabric network up and down with a simple command. +However, If you want to build up the Hyperledger Fabric network in the distributing development environments, it is not a easy task and you have to deploy the modules in each of the machine manually, which is including lots of configurations and commands and inconvenient. Our preject is a tool to help you to install the hyperledger fabric in the distributing development environments easily and conveniently. + +The deployment tool provides basic mechanisms for deployment, repairment, and scaling of applications. Firstly, once you have completed the configuration of the orderer and peer,witch include the information of the role,the domain and ip address, the tool can deploy the orderer and the peer according the configuration you written by itself. Secondly, when the hyperledger fabric network is running, the tool can scale your hyperledger fabric network up and down with a simple command. ## Prerequisites @@ -23,7 +25,7 @@ cd fabric-samples/distributed-deploy/ mvn package -DskipTests ``` -After that the jar is built in the *bcp-install-main/target* and you enter the root of the fabric and run the command make release,and you need to copy the configtxgen,configtxlator and cryptogen to the directory of the path as follow: +After that the jar is built in the *bcp-install-main/target* and you enter the root of the fabric and run the command make release, and you need to copy the **configtxgen**, **configtxlator** and **cryptogen** to the directory of the path as follow: *bcp-install-main/resources/generateInstallPackage/masterPackage/tools/linux* @@ -31,17 +33,17 @@ After that the jar is built in the *bcp-install-main/target* and you enter the r ### Install the intall.jar -In this section,we will show how to use our tool to deploy the hyperledger fabric network includding two peers named peer0 and peer1 and three orderers named orderer0,orderer2,orderer3 in the distributing development environments。 +In this section, we will show how to use our tool to deploy the hyperledger fabric network includding two peers named `peer0` and `peer1` and three orderers named `orderer0`, `orderer2`, `orderer3` in the distributing development environments. -After you have built the bcp-install.jar in your project, now you need to copy the jar to the directory named masterPackage and slavePackage, they are both under the generateInstallPackage as the picture1 show;You should notice that you also need to upload the masterPackage and slavePackage to the machines, the masterPackage should be uploaded to master node and slavePackage should be the slave one. +After you have built the bcp-install.jar in your project, now you need to copy the jar to the directory named masterPackage and slavePackage, they are both under the **generateInstallPackage** as the picture1 show. You should notice that you also need to upload the masterPackage and slavePackage to the machines, the masterPackage should be uploaded to master node and slavePackage should be the slave one. ![](./static/masterPackage.png) -Then we will show you how to deploy the the hyperledger fabric network, in the presentation below, we have two peer nodes named peer0 and peer1,and we have three orderer nodes named oderder0,orderer1,orderer2,and we choose peer0 as master node and the others are the slave ones. +Then we will show you how to deploy the the hyperledger fabric network, in the presentation below, we have two peer nodes named `peer0` and `peer1`, and we have three orderer nodes named `oderder0`, `orderer1`, `orderer2`, and we choose `peer0` as master node and the others are the slave ones. ### About the initconfig.propertise -In this section, you will learn about the configuration of the file initconfig.propertise. The file initconfig.propertise is located in the directory masterPackage and is important to the tool for the deployment, since it contains the information about fabric network such as info of the organization in the hyperledger,the channel info such as the chanelName and the information of orderer node and the peer node and so on. The description about the attribution in initconfig.propertise is shown in the table below and in this example, our initconfig.propertise is also shown below。 +In this section, you will learn about the configuration of the file initconfig.propertise. The file initconfig.propertise is located in the directory masterPackage and is important to the tool for the deployment, since it contains the information about fabric network such as info of the organization in the hyperledger, the channel info such as the chanelName and the information of orderer node and the peer node and so on. The description about the attribution in initconfig.propertise is shown in the table below and in this example, our initconfig.propertise is also shown below. | Attribution | Description | | ------------ | ------------ | @@ -62,13 +64,13 @@ In this section, you will learn about the configuration of the file initconfig.p ### Config your initconfig.properties -The initconfig.properties in the masterPackage offer the info of all the hyperledger fabric network you want to build,and you need to config the information of your network in it,such as the ip and port of the node。In the example,just as the picture2 show below,you can see that we set all of the ip and port of the nodes of fabric network includding peer0、peer1、orderer0、orderer1 and orderer2. +The initconfig.properties in the masterPackage offer the info of all the hyperledger fabric network you want to build, and you need to config the information of your network in it, such as the ip and port of the node. In the example, just as the picture2 show below, you can see that we set all of the ip and port of the nodes of fabric network includding `peer0`、`peer1`、`orderer0`、`orderer1` and `orderer2`. ![](./static/config_initconfig_propertise.png) ### Intall your hyperledger fabric -When you come to this step,you can run the script to deploy your network。In previous step,you have uploaded the slavePackage to every slave machine,and under the directory,there is a script named start-installService-slave.sh。Now you need to run the scrip named start-installService-slave.sh in the slavePackage directory in each of the slave machine with the command below,the parameter of p should follow the absolute path the fabric network you want to deploy.In this example, we choose /home/deploy as our deployment path. +When you come to this step, you can run the script to deploy your network. In previous step, you have uploaded the slavePackage to every slave machine, and under the directory, there is a script named start-installService-slave.sh. Now you need to run the scrip named start-installService-slave.sh in the slavePackage directory in each of the slave machine with the command below, the parameter of p should follow the absolute path the fabric network you want to deploy.In this example, we choose /home/deploy as our deployment path. ```shell ./start-installService-slave.sh -p /path/to/deloy @@ -76,41 +78,41 @@ When you come to this step,you can run the script to deploy your network。In ![](./static/start_slave.png) -After completed the deployment in the slave machine,you need to deploy the master machine。Remember that in this example,we choose the peer0 as our master machine and we upload the masterPackage in it and now we need to run the script start-installService-master.sh with the command below。The parameter m is symbol for the pattern you want to deploy your network,you have two choices,the newInstall and updateNetwork,which newInstall means you are the first time to install the fabric network and the updateNetwork means you want to update the network。The parameter p is just as the start-installService-slave.sh above,should be follow the absolute path the fabric network you want to deploy。In this example,we run the command sh start-installService-master.sh -m newInstall -p /home/deploy” to start the deployment in the master machine. +After completed the deployment in the slave machine, you need to deploy the master machine. Remember that in this example, we choose the peer0 as our master machine and we upload the masterPackage in it and now we need to run the script start-installService-master.sh with the command below. The parameter m is symbol for the pattern you want to deploy your network, you have two choices, the newInstall and updateNetwork, which newInstall means you are the first time to install the fabric network and the updateNetwork means you want to update the network. The parameter p is just as the start-installService-slave.sh above,should be follow the absolute path the fabric network you want to deploy. In this example, we run the command: ```shell -./start-installService-slave.sh -m newInstall/updateNetwork -p /path/to/deloy +./start-installService-slave.sh -m newInstall/updateNetwork -p /path/to/deloy ``` ![](./static/start_master.png) ## Scale up/down your hyperledger fabric -In this section,you will learn how to scale up the hyperledger fabric network using our tool. +In this section, you will learn how to scale up the hyperledger fabric network using our tool. -When you want to scale up or down your fabric network,you need to config the config properties initconfig.propertise。For example,if you want to scale up your network,you should add the node info such as the domain,ip and port and so on into the peerHostConfig section or ordererHostConfig section,according to which one you want to add。When you want to scale down the network,you need to delete the node info in the peerHostConfig section or ordererHostConfig section,according to which one you want to delete. +When you want to scale up or down your fabric network, you need to config the config properties initconfig.propertise. For example, if you want to scale up your network, you should add the node info such as the domain, ip and port and so on into the peerHostConfig section or ordererHostConfig section,according to which one you want to add. When you want to scale down the network, you need to delete the node info in the peerHostConfig section or ordererHostConfig section, according to which one you want to delete. -After you have completed the modification about the initconfig.propertise,you can startup your peer node or orderer node. +After you have completed the modification about the initconfig.propertise, you can startup your peer node or orderer node. -When you want to add a new peer in your fabric network,firstly,you should run the start-installService-master.sh in the master machine,in this example,we execute the command below,you need to pay attention to the path follow the parameter p,which need to be the same as the path as you intall the network in the master machine. +When you want to add a new peer in your fabric network, firstly, you should run the start-installService-master.sh in the master machine, in this example, we execute the command below, you need to pay attention to the path follow the parameter p, which need to be the same as the path as you intall the network in the master machine. ```shell ./start-installService-master.sh -m updateNetwork -p /home/bcp-master ``` -After that,you need to run the script start-installService-slave.sh in the slave machine,it is keypoint that you should only run the script on the machine you want to add to the network.not all the salve machine.And in this example,we run the command below in the slave machine. +After that, you need to run the script start-installService-slave.sh in the slave machine, it is keypoint that you should only run the script on the machine you want to add to the network not all the salve machine. And in this example, we run the command below in the slave machine: ```shell ./start-installService-slave.sh -p /home/deploy ``` -When you want to add a new orderer in your fabric network,one thing you should notice is the addition of the orderer node will be influence the fabric network and there will be a little difference from the steps when you add a peer node. Firstly,you should run the start-installService-master.sh in the master machine,in this example,we execute the command below,you need to pay attention to the path follow the parameter p,just as the mention above,which need to be the same as the path as you install the network in the master machine. +When you want to add a new orderer in your fabric network, one thing you should notice is the addition of the orderer node will be influence the fabric network and there will be a little difference from the steps when you add a peer node. Firstly, you should run the start-installService-master.sh in the master machine, in this example, we execute the command below, you need to pay attention to the path follow the parameter p, just as the mention above, which need to be the same as the path as you install the network in the master machine: ```shell ./start-installService-master.sh -m updateNetwork -p /home/bcp-master ``` -After that,you need to run the script start-installService-slave.sh in the slave machine,it is key-point that you should not only run the script on the machine you want to add to the network but also all the salve machines you have intall the orderer node. And in this example,we run the command below in the slave machine. +After that, you need to run the script start-installService-slave.sh in the slave machine, it is key-point that you should not only run the script on the machine you want to add to the network but also all the salve machines you have intall the orderer node. And in this example, we run the command below in the slave machine: ```shell ./start-installService-slave.sh -p /home/deploy diff --git a/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/InstallController.java b/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/InstallController.java index 6f74fc9e..89201e7c 100644 --- a/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/InstallController.java +++ b/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/InstallController.java @@ -98,7 +98,8 @@ public class InstallController { public void getInstallData(@PathVariable("os") String osType, HttpServletRequest request, HttpServletResponse response) { String remoteAddr = request.getRemoteAddr(); - log.info(String.format("从节点 %s 开始下载安装包", remoteAddr)); + // log.info(String.format("从节点 %s 开始下载安装包", remoteAddr)); + log.info(String.format("The slave node %s starts to download the installation package", remoteAddr)); BaseResponse downloadResponse = new BaseResponse(); @@ -106,14 +107,16 @@ public class InstallController { try { osEnum = OSEnum.valueOf(osType); } catch (Exception e) { - log.error("解析系统类型异常", e); + // log.error("解析系统类型异常", e); + log.error("Parsing system type exception", e); e.printStackTrace(); } if (osEnum == null) { - log.error(String.format("从节点系统类型错误: %s", osType)); + // log.error(String.format("从节点系统类型错误: %s", osType)); downloadResponse.setCode(ResponseCode.Fail); - downloadResponse.setMsg("不支持指定的系统类型: " + osType); + // downloadResponse.setMsg("不支持指定的系统类型: " + osType); + downloadResponse.setMsg("Slave node system type error: " + osType); setErrorResult(response, downloadResponse); return; } @@ -124,7 +127,8 @@ public class InstallController { String filePath = fileService.packInstallFiles(remoteAddr, roleList, null); if (StringUtils.isEmpty(filePath)) { downloadResponse.setCode(ResponseCode.Fail); - downloadResponse.setMsg("打包安装文件失败"); + // downloadResponse.setMsg("打包安装文件失败"); + downloadResponse.setMsg("Package installation file failed"); setErrorResult(response, downloadResponse); return; } @@ -147,23 +151,28 @@ public class InstallController { IOUtils.copy(is, os); // 修改服务器对应的状态 - log.info(String.format("设置从节点 %s 状态为下载完成", remoteAddr)); + // log.info(String.format("设置从节点 %s 状态为下载完成", remoteAddr)); + log.info(String.format("Set slave node %s status to download complete", remoteAddr)); this.rolesBiz.setServerStatus(remoteAddr, InstallStatusEnum.DOWNLOADED); } catch (FileNotFoundException e) { - log.error("下载文件不存在", e); + // log.error("下载文件不存在", e); + log.error("The download file does not exist", e); e.printStackTrace(); downloadResponse.setCode(ResponseCode.Fail); - downloadResponse.setMsg("下载文件不存在"); + // downloadResponse.setMsg("下载文件不存在"); + downloadResponse.setMsg("The download file does not exist"); setErrorResult(response, downloadResponse); } catch (IOException e) { - log.error("获取HttpServletResponse输出流发生异常", e); + // log.error("获取HttpServletResponse输出流发生异常", e); + log.error("Get HttpServletResponse output stream exception", e); e.printStackTrace(); downloadResponse.setCode(ResponseCode.Fail); - downloadResponse.setMsg("获取HttpServletResponse输出流发生异常"); + // downloadResponse.setMsg("获取HttpServletResponse输出流发生异常"); + downloadResponse.setMsg("Get HttpServletResponse output stream exception"); setErrorResult(response, downloadResponse); } finally { @@ -176,7 +185,8 @@ public class InstallController { @ApiOperation(value = "下载安装文件") @InvokeLog(name = "pushInstallPackage", description = "推送安装文件") public HttpInstallResponse pushInstallPackage(HttpServletRequest request) { - log.info("准备接收主节点推送的安装包"); + // log.info("准备接收主节点推送的安装包"); + log.info("Prepare to receive the installation package pushed by the master node"); this.installBiz.setMasterServer("http://" + request.getRemoteAddr() + ":8080"); @@ -188,7 +198,8 @@ public class InstallController { this.installBiz.installPackageReady(); } catch (Exception e) { - log.error("接收安装包异常", e); + // log.error("接收安装包异常", e); + log.error("Abnormal reception of installation package", e); response.setCode(ResponseCode.Fail.getCode()); e.printStackTrace(); } @@ -220,7 +231,8 @@ public class InstallController { @InvokeLog(name = "doInstall", description = "开始安装") public HttpInstallResponse doInstall(HttpServletRequest request) { HttpInstallResponse response = new HttpInstallResponse(); - log.info("从节点收到安装指令"); + // log.info("从节点收到安装指令"); + log.info("The slave node receives the installation instruction"); try { //获取安装指令实例 Part contentPart = request.getPart("content"); @@ -281,7 +293,8 @@ public class InstallController { Part part = request.getPart("file"); part.write(filePath); } - log.info("从节点收到移除指令"); + // log.info("从节点收到移除指令"); + log.info("The slave node received the removal instruction"); String domain = removeCmd.getRole() == RoleEnum.ORDER ? removeCmd.getOrdererDomain() : removeCmd.getPeerDomain(); updateService.removeNode(removeCmd.getRole(), domain, removeCmd.getHostNames(), removeCmd.getPorts()); } catch (Exception e) { @@ -311,7 +324,8 @@ public class InstallController { Part part = request.getPart("file"); installBiz.handleUpdate(cmd, part); } catch (Exception e) { - log.error("接收更新指令异常", e); + // log.error("接收更新指令异常", e); + log.error("Receive update instruction exception", e); response.setCode(ResponseCode.Fail.getCode()); e.printStackTrace(); } @@ -330,7 +344,8 @@ public class InstallController { @ApiOperation(value = "完成安装") @InvokeLog(name = "installFinished", description = "完成安装") public HttpInstallResponse installFinished(@RequestBody InstallResult result, HttpServletRequest request) { - log.info(String.format("从节点 %s 完成安装", request.getRemoteAddr())); + // log.info(String.format("从节点 %s 完成安装", request.getRemoteAddr())); + log.info(String.format("Slave node %s completes the installation", request.getRemoteAddr())); modeService.updateInstallResult(request.getRemoteAddr(), result, null); return new HttpInstallResponse(); @@ -346,7 +361,8 @@ public class InstallController { @ApiOperation(value = "结束安装") @InvokeLog(name = "endInstall", description = "结束安装") public HttpInstallResponse endInstall(@RequestBody EndCmd result) { - log.info("从节点收到结束安装指令"); + // log.info("从节点收到结束安装指令"); + log.info("The master node receives the end installation instruction"); this.installBiz.doEnd(); return new HttpInstallResponse(); diff --git a/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/RegisterController.java b/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/RegisterController.java index 1c245db0..83505d7f 100644 --- a/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/RegisterController.java +++ b/distributed-deploy/bcp-install-api/src/main/java/com/cgb/bcpinstall/api/controller/RegisterController.java @@ -55,7 +55,8 @@ public class RegisterController { public HttpInstallResponse regRole(@RequestBody RoleRegEntity roleRegEntity, HttpServletRequest request) { String remoteAddr = request.getRemoteAddr(); - log.info(String.format("从节点 %s 开始注册", remoteAddr)); + // log.info(String.format("从节点 %s 开始注册", remoteAddr)); + log.info(String.format("Slave node %s starts registration", remoteAddr)); roleService.addServerRole(remoteAddr, roleRegEntity.getServerPort(),null); diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InitializeBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InitializeBiz.java index da84d645..37d9590d 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InitializeBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InitializeBiz.java @@ -63,23 +63,28 @@ public class InitializeBiz { InitConfigEntity configEntity = initConfigService.parseConfigFile(this.initConfigFile); if (configEntity == null) { response.setCode(ResponseCode.Fail); - response.setMsg("解析初始化配置文件失败"); + // response.setMsg("解析初始化配置文件失败"); + response.setMsg("Failed to parse the initialization configuration file"); return response; } if (!initConfigService.isCorrectConfig(configEntity)) { - log.error("配置文件中相关配置项出错或为空"); + // log.error("配置文件中相关配置项出错或为空"); + log.error("The relevant configuration items in the configuration file are wrong or empty"); response.setCode(ResponseCode.Fail); - response.setMsg("配置文件中相关配置项出错或为空"); + // response.setMsg("配置文件中相关配置项出错或为空"); + response.setMsg("The relevant configuration items in the configuration file are wrong or empty"); return response; } configFileGen.createConfigFile(configEntity); } catch (FileNotFoundException fe) { - log.error("文件不存在异常", fe); + // log.error("文件不存在异常", fe); + log.error("Exception file does not exist", fe); response.setCode(ResponseCode.Fail); fe.printStackTrace(); } catch (Exception e) { - log.error("初始化发生异常", e); + // log.error("初始化发生异常", e); + log.error("Exception occurred during initialization", e); response.setCode(ResponseCode.Fail); e.printStackTrace(); } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InstallBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InstallBiz.java index 94b73d8d..bdc0d52d 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InstallBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/InstallBiz.java @@ -106,7 +106,8 @@ public class InstallBiz { if (this.globalConfig.getMaster() == 1) { File configFile = new File(this.initConfigFile); if (!configFile.exists() || !configFile.isFile()) { - log.error(String.format("initconfig.propertise(传入的路径:%s)文件不存在, 请按任意键结束,重新运行", this.initConfigFile)); + // log.error(String.format("initconfig.propertise(传入的路径:%s)文件不存在, 请按任意键结束,重新运行", this.initConfigFile)); + log.error(String.format("initconfig.propertise(Incoming path:%s) the file does not exist, please press any key to end and re-run", this.initConfigFile)); this.finished.set(true); return; } @@ -114,7 +115,8 @@ public class InstallBiz { try { this.configEntity = initConfigService.parseConfigFile(this.initConfigFile); if (configEntity == null) { - log.error("解析初始化配置文件失败"); + // log.error("解析初始化配置文件失败"); + log.error("Failed to parse the initialization configuration file"); this.doEnd(); return; } @@ -124,12 +126,14 @@ public class InstallBiz { return; } if (this.configEntity.getOrdererHostConfig().size() < 3) { - log.error("orderer 节点不能少于3个,请重新编辑配置文件,结束安装"); + // log.error("orderer 节点不能少于3个,请重新编辑配置文件,结束安装"); + log.error("There must be at least 3 orderer nodes, please edit the configuration file again to end the installation"); this.doEnd(); return; } if (this.configEntity.getPeerHostConfig().size() < 2) { - log.error("peer 节点不能少于2个,请重新编辑配置文件,结束安装"); + // log.error("peer 节点不能少于2个,请重新编辑配置文件,结束安装"); + log.error("There must be at least two peer nodes. please edit the configuration file again to end the installation"); this.doEnd(); return; } @@ -140,7 +144,8 @@ public class InstallBiz { if (checkModifyInstall()) { installModeAction = (InstallMode) SpringUtil.getBean("updateNetworkBiz"); } else { - System.out.println("在配置文件中没有找到需要更新的信息"); + // System.out.println("在配置文件中没有找到需要更新的信息"); + System.out.println("No information needed to be updated in the configuration file"); } } if (installModeAction != null) { @@ -149,7 +154,8 @@ public class InstallBiz { } } catch (Exception e) { - log.error("安装过程发生异常", e); + // log.error("安装过程发生异常", e); + log.error("An exception occurred during the installation process", e); e.printStackTrace(); } } @@ -164,7 +170,8 @@ public class InstallBiz { try { return !this.checkPointDb.nodesTableEmpty(); } catch (SQLException e) { - log.error("查询本地数据库失败", e); + // log.error("查询本地数据库失败", e); + log.error("Query local database failed", e); e.printStackTrace(); } @@ -178,7 +185,8 @@ public class InstallBiz { */ public void slaveInstall(RoleEnum role, List ports, Map hosts, String roleFolderName) { new Thread(() -> { - log.info(String.format("从节点开始进行角色 %s 的安装", role.name())); + // log.info(String.format("从节点开始进行角色 %s 的安装", role.name())); + log.info(String.format("The slave node starts the installation of role %s", role.name())); if (this.startInstall(role, ports, hosts, roleFolderName)) { InstallResult result = new InstallResult(); result.setRole(role); @@ -189,11 +197,13 @@ public class InstallBiz { if (!StringUtils.isEmpty(res)) { HttpInstallResponse response = JSONObject.parseObject(res, HttpInstallResponse.class); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.info(String.format("向主节点报告安装 %s 状态成功", role.name())); + // log.info(String.format("向主节点报告安装 %s 状态成功", role.name())); + log.info(String.format("Report successful installation %s status to the master node", role.name())); break; } } - log.info(String.format("向主节点报告安装 %s 状态失败,稍后重试...", role.name())); + // log.info(String.format("向主节点报告安装 %s 状态失败,稍后重试...", role.name())); + log.info(String.format("Report failed installation %s status to the master node, try again later ...", role.name())); try { Thread.sleep(5000); } catch (Exception e) { @@ -202,7 +212,8 @@ public class InstallBiz { } while (true); } catch (Exception e) { - log.error("向主服务器发送安装完成状态异常", e); + // log.error("向主服务器发送安装完成状态异常", e); + log.error("Send abnormal installation completion status to the main server", e); e.printStackTrace(); } } @@ -243,17 +254,19 @@ public class InstallBiz { try { ProcessUtil.Result result = ProcessUtil.execCmd("docker exec " + currentOrdererName + " bash updateOrdererHost.sh " + newOrderName + " " + ip, null, modeService.getInstallPath()); if (result.getCode() == 0) { - log.info(String.format("更新 docker 容器 %s 的 Hosts 成功: ", currentOrdererName)); + // log.info(String.format("更新 docker 容器 %s 的 Hosts 成功: ", currentOrdererName)); + log.info(String.format("Successfully updated Hosts of docker container %s: ", currentOrdererName)); } else { - log.error(String.format("更新 docker 容器 %s 的 Hosts 失败: " + result.getData(), currentOrdererName)); + // log.error(String.format("更新 docker 容器 %s 的 Hosts 失败: " + result.getData(), currentOrdererName)); + log.error(String.format("Failed to update Hosts of docker container %s: " + result.getData(), currentOrdererName)); } } catch (Exception e) { - log.error(String.format("更新 docker 容器 %s 的 HostsPath 异常", currentOrdererName), e); + // log.error(String.format("更新 docker 容器 %s 的 HostsPath 异常", currentOrdererName), e); + log.error(String.format("Update HostsPath exception of docker container %s", currentOrdererName), e); e.printStackTrace(); } } - public void handleUpdate(UpdateCmd cmd, Part part) { try { if (cmd.getRole() == RoleEnum.ORDER) { @@ -273,7 +286,7 @@ public class InstallBiz { public void doEnd() { this.finished.set(true); - System.out.println("*****安装服务已完成*****"); + // System.out.println("*****安装服务已完成*****"); + System.out.println("*****Installation service is complete*****"); } - } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/NewInstallBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/NewInstallBiz.java index 5edb246e..b0f191b0 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/NewInstallBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/NewInstallBiz.java @@ -75,12 +75,14 @@ public class NewInstallBiz implements InstallMode { @Override public void run(InitConfigEntity configEntity) { - log.info("主节点开始安装流程..."); + // log.info("主节点开始安装流程..."); + log.info("The master node starts the installation process..."); // 将所有的从节点注册到角色列表 registerSlaveServers(configEntity); - log.info("主节点添加到角色列表"); + // log.info("主节点添加到角色列表"); + log.info("Add the master node to the role list"); // 也把自己添加到角色列表里 List allMyIps = NetUtil.getLocalIPList(); @@ -90,12 +92,14 @@ public class NewInstallBiz implements InstallMode { List allMyRoles = this.getAllMyRoles(); - log.info("主节点复制安装文件"); + // log.info("主节点复制安装文件"); + log.info("Copy the installation file to the master node"); // 为自己复制安装文件 fileService.copyInstallFiles(allMyIps, allMyRoles, configEntity); // 修改自己的状态 - log.info("主节点修改安装状态"); + // log.info("主节点修改安装状态"); + log.info("Master node to modify the installation status"); for (String ip : allMyIps) { this.rolesBiz.setServerStatus(ip, InstallStatusEnum.DOWNLOADED); } @@ -112,18 +116,22 @@ public class NewInstallBiz implements InstallMode { } } - log.info("将安装包推给每个从节点"); + // log.info("将安装包推给每个从节点"); + log.info("Push the installation package to each slave node"); pushInstallPackages(configEntity); - log.info("安装 orderer"); + // log.info("安装 orderer"); + log.info("Install orderer"); // 首先安装 Orderer installService.install(RoleEnum.ORDER, configEntity); - log.info("安装 peer"); + // log.info("安装 peer"); + log.info("Install peer"); // 安装 Peer installService.install(RoleEnum.PEER, configEntity); - log.info("等待所有节点完成安装..."); + // log.info("等待所有节点完成安装..."); + log.info("Wait for all nodes to complete the installation..."); int retryCount = 1; int retryTotal = 7; while (true) { @@ -131,7 +139,8 @@ public class NewInstallBiz implements InstallMode { break; } if (retryCount == retryTotal) { - log.info("安装状态查询超时,部署可能出现异常,请排查!"); + // log.info("安装状态查询超时,部署可能出现异常,请排查!"); + log.info("Installation status query timed out, deployment may be abnormal, please check!"); break; } try { @@ -142,7 +151,8 @@ public class NewInstallBiz implements InstallMode { retryCount++; } - log.info("通知所有服务器安装结束"); + // log.info("通知所有服务器安装结束"); + log.info("Notify all servers that installation is complete"); // 通知所有服务器结束 Set serverUrl = getServersUrl(); remoteService.notifyNodesToEnd(serverUrl); @@ -155,7 +165,6 @@ public class NewInstallBiz implements InstallMode { } } - private List getAllMyRoles() { List roleList = new ArrayList<>(); @@ -174,7 +183,8 @@ public class NewInstallBiz implements InstallMode { } private boolean createFabricGenesis(InitConfigEntity configEntity) { - log.info("开始 fabric 创世"); + // log.info("开始 fabric 创世"); + log.info("Start fabric create genesis"); String fabricDir = modeService.getInstallPath() + "channel-artifacts" + File.separator; FileUtil.makeFilePath(fabricDir, true); @@ -182,17 +192,21 @@ public class NewInstallBiz implements InstallMode { String sysChannelName = configEntity.getNetwork() + "-sys-channel"; String cmd = CacheUtil.getConfigtxgenFilePath() + " -profile SampleMultiNodeEtcdRaft -channelID " + sysChannelName + " -outputBlock " + fabricDir + "genesis.block"; - log.info("生成创世块-执行命令:" + cmd); + // log.info("生成创世块-执行命令:" + cmd); + log.info("Generate genesis block -- execute command:" + cmd); try { ProcessUtil.Result res = ProcessUtil.execCmd(cmd, null, modeService.getInstallPath()); if (res.getCode() == 0) { - log.info("创世成功"); + // log.info("创世成功"); + log.info("Genesis block creation succeeded"); return true; } else { - log.warn("创世失败"); + // log.warn("创世失败"); + log.warn("Genesis block creation failed"); } } catch (Exception e) { - log.error("生成创世块异常", e); + // log.error("生成创世块异常", e); + log.error("Genesis block creation abnormal", e); e.printStackTrace(); } @@ -204,7 +218,8 @@ public class NewInstallBiz implements InstallMode { List allSlaveIps = parseAllSlaveIps(configEntity); //推送安装包 for (String slaveIp : allSlaveIps) { - log.info(String.format("向从节点 %s 推送安装包", slaveIp)); + // log.info(String.format("向从节点 %s 推送安装包", slaveIp)); + log.info(String.format("Push the installation package to the master node %s", slaveIp)); remoteService.pushSlaveInstallPackage(slaveIp, configEntity); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererExtendBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererExtendBiz.java index 737d540b..cb324d01 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererExtendBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererExtendBiz.java @@ -89,19 +89,22 @@ public class OrdererExtendBiz { private DockerConfigGenImpl dockerConfigGen; public void ordererExtend(Map newOrdererHostConfig, InitConfigEntity configEntity) { - log.info("为新增 orderer 生成证书"); + // log.info("为新增 orderer 生成证书"); + log.info("Generate certificate for new orderer"); // 生成证书 try { fabricConfigGen.configTxGen(configEntity); fabricConfigGen.cryptoGen(configEntity); configFileGen.createExtendCerts(); } catch (Exception e) { - log.error("为新增的 orderer 节点生成证书异常", e); + // log.error("为新增的 orderer 节点生成证书异常", e); + log.error("Generate certificate exception for newly added orderer node", e); e.printStackTrace(); return; } - log.info("为新增 orderer 生成 docker 相关文件"); + // log.info("为新增 orderer 生成 docker 相关文件"); + log.info("Generate docker related files for new orderer"); // 生成 docker-compose-order-xxxx.yaml 和 start-order.sh 文件 Map filePathMap = new HashMap<>(16); @@ -122,65 +125,78 @@ public class OrdererExtendBiz { } } - log.info("将新生成的证书拷贝到主节点安装目录"); + // log.info("将新生成的证书拷贝到主节点安装目录"); + log.info("Copy the newly generated certificate to the master node installation directory"); fileService.masterCopyCryptoConfig(); fileService.masterCopyConfigtxFile(); // 启动一个 cli 容器 - log.info("主节点创建cli容器"); + // log.info("主节点创建cli容器"); + log.info("The master node creates a cli container"); if (!fabricCliService.createCliContainer(modeService.getInstallPath() + "cli", configEntity)) { - log.error("创建cli容器失败"); + // log.error("创建cli容器失败"); + log.error("Failed to create cli container"); return; } - log.info("修改所有其他 orderer 节点配置"); + // log.info("修改所有其他 orderer 节点配置"); + log.info("Modify all other orderer node configurations"); // 修改所有其他 orderer 节点配置,并重启 updateOldOrdererContainers(newOrdererHostConfig, configEntity); // 收集所有节点加入的通道 - log.info("获取所有节点加入的通道列表"); + // log.info("获取所有节点加入的通道列表"); + log.info("Get a list of channels added by all nodes"); Set channelList = new HashSet<>(); try { channelList.addAll(fabricCliService.getAllChannels(configEntity)); } catch (IOException e) { - log.error("获取节点加入的所有通道异常", e); + // log.error("获取节点加入的所有通道异常", e); + log.error("Get all the channels that the node joins are abnormal", e); e.printStackTrace(); } - - log.info("修改网络配置"); + // log.info("修改网络配置"); + log.info("Modify network configuration"); // 修改网络配置 - log.info("将新加入的 orderer(s) 加入系统通道"); + // log.info("将新加入的 orderer(s) 加入系统通道"); + log.info("Add the newly added orderer(s) to the system channel"); Map oldOrdererConfig = updateService.getOldNodeConfigMap(configEntity.getOrdererHostConfig(), newOrdererHostConfig); for (String newOrdererHost : newOrdererHostConfig.keySet()) { - log.info("扩容orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); + // log.info("扩容orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); + log.info("Expansion orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); oldOrdererConfig.put(newOrdererHost, newOrdererHostConfig.get(newOrdererHost)); // 先修改系统通道 if (!updateService.updateNetworkConfig(configEntity.getNetwork() + "-sys-channel", configEntity, oldOrdererConfig)) { - log.error(String.format("为系统通道 %s 更新网络配置失败", configEntity.getNetwork() + "-sys-channel")); + // log.error(String.format("为系统通道 %s 更新网络配置失败", configEntity.getNetwork() + "-sys-channel")); + log.error(String.format("Failed to update network configuration for system channel %s", configEntity.getNetwork() + "-sys-channel")); return; } // 更新业务通道 if (!CollectionUtils.isEmpty(channelList)) { for (String channelName : channelList) { - log.info(String.format("将新加入的 orderer(s) 加入 %s 通道", channelName)); + // log.info(String.format("将新加入的 orderer(s) 加入 %s 通道", channelName)); + log.info(String.format("Add the newly added orderer(s) to the %s channel", channelName)); if (!updateService.updateNetworkConfig(channelName, configEntity, oldOrdererConfig)) { - log.error(String.format("为通道 %s 更新网络配置失败", channelName)); + // log.error(String.format("为通道 %s 更新网络配置失败", channelName)); + log.error(String.format("Failed to update network configuration for channel %s", channelName)); } } } } - - log.info("获取最新创世块"); + // log.info("获取最新创世块"); + log.info("Get the latest genesis block"); if (!fabricCliService.fetchGenesisBlock(configEntity)) { - log.error("获取创世块发生错误"); + // log.error("获取创世块发生错误"); + log.error("Error getting genesis block"); } - log.info("注册 orderer 节点角色"); + // log.info("注册 orderer 节点角色"); + log.info("Register orderer node role"); List ports = new ArrayList<>(); for (String ip : orderGroups.keySet()) { List hostList = orderGroups.get(ip); @@ -200,20 +216,24 @@ public class OrdererExtendBiz { fileService.copyFiles(RoleEnum.ORDER, ip, folderName, modeService.getInstallPath(), folderName, configEntity, null); this.rolesBiz.setServerStatus(ip, InstallStatusEnum.DOWNLOADED); } else { - log.info("为新增 orderer 打包安装包"); + // log.info("为新增 orderer 打包安装包"); + log.info("Package installation package for new orderer"); String packFilePath = fileService.packExtendNodeFiles(ip, folderName, RoleEnum.ORDER, configEntity); // 发送到节点启动 - log.info("将生成的文件包发送到新增 orderer 节点"); + // log.info("将生成的文件包发送到新增 orderer 节点"); + log.info("Send the generated file package to the newly added orderer node"); remoteService.pushSlaveInstallPackage(ip, packFilePath, configEntity); } } - log.info("启动 orderer 节点"); + // log.info("启动 orderer 节点"); + log.info("Start the orderer node"); // 等待节点启动成功 List serverList = this.rolesBiz.getRolesMap().get(RoleEnum.ORDER); for (String ip : filePathMap.keySet()) { - log.info(String.format("发送安装命令到新增 orderer 节点 %s", ip)); + // log.info(String.format("发送安装命令到新增 orderer 节点 %s", ip)); + log.info(String.format("Send installation command to newly added orderer node %s", ip)); String path = filePathMap.get(ip); @@ -232,12 +252,14 @@ public class OrdererExtendBiz { do { HttpInstallResponse response = remoteService.sendInstallCommand(server, RoleEnum.ORDER, folderName, configEntity); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.warn(String.format("发送安装指令给 %s 节点安装 orderer 成功", ip)); + // log.warn(String.format("发送安装指令给 %s 节点安装 orderer 成功", ip)); + log.warn(String.format("Send installation instructions to %s node to install orderer successfully", ip)); this.rolesBiz.setServerStatus(ip, InstallStatusEnum.INSTALLING); break; } - log.warn(String.format("发送安装指令给 %s 节点安装 orderer 失败,稍后重试...", ip)); + // log.warn(String.format("发送安装指令给 %s 节点安装 orderer 失败,稍后重试...", ip)); + log.warn(String.format("Sending installation instructions to %s node failed to install orderer, try again later...", ip)); try { Thread.sleep(3000); } catch (InterruptedException e) { @@ -250,7 +272,8 @@ public class OrdererExtendBiz { } } - log.info("等待所有 orderer 启动成功"); + // log.info("等待所有 orderer 启动成功"); + log.info("Wait for all orderers to start successfully"); while (serverList.stream().anyMatch(s -> s.getStatus() != InstallStatusEnum.SUCCESS)) { try { Thread.sleep(5000); @@ -259,7 +282,8 @@ public class OrdererExtendBiz { } } - log.info("将新 orderer(s) 信息加入本地数据库"); + // log.info("将新 orderer(s) 信息加入本地数据库"); + log.info("Add new orderer(s) information to local database"); // 更新数据库 for (String host : newOrdererHostConfig.keySet()) { String ip = newOrdererHostConfig.get(host); @@ -278,14 +302,13 @@ public class OrdererExtendBiz { try { this.checkPointDb.addNodeRecord(nodeDO); } catch (SQLException e) { - log.error(String.format("添加新 orderer 节点 %s 记录到数据库异常", host), e); + // log.error(String.format("添加新 orderer 节点 %s 记录到数据库异常", host), e); + log.error(String.format("Exception when adding a new orderer node %s to the database", host), e); e.printStackTrace(); } } - } - /** * 更新原 orderer 节点 * @@ -329,7 +352,8 @@ public class OrdererExtendBiz { FileUtils.copyFile(new File(updateOrdererHostPath), new File(shDesPath)); installBiz.updateOrderers(cmd); } catch (IOException e) { - log.error("复制updateOrdererHost.sh文件发生异常"); + // log.error("复制updateOrdererHost.sh文件发生异常"); + log.error("An exception occurred while copying updateOrdererHost.sh file"); e.printStackTrace(); } } else { @@ -337,7 +361,8 @@ public class OrdererExtendBiz { int retryTotal = 10; do { if (retryTotal == retryInit) { - log.error("重试超过次数"); + // log.error("重试超过次数"); + log.error("Error due to more retries"); break; } String result = this.httpClient.sendFileAndJson("http://" + ip + ":8080/v1/install/update", updateOrdererHostPath, JSONObject.toJSONString(cmd)); @@ -347,7 +372,8 @@ public class OrdererExtendBiz { break; } } - log.error(String.format("发送更新 orderer 指令到节点 %s 返回错误, 稍后重试", ip)); + // log.error(String.format("发送更新 orderer 指令到节点 %s 返回错误, 稍后重试", ip)); + log.error(String.format("An error was returned when sending the update orderer command to node %s, try again later", ip)); try { Thread.sleep(3000); } catch (InterruptedException e) { @@ -358,6 +384,4 @@ public class OrdererExtendBiz { } } } - - } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererRemoveBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererRemoveBiz.java index e935b2bc..467c6cc6 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererRemoveBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/OrdererRemoveBiz.java @@ -66,53 +66,66 @@ public class OrdererRemoveBiz { private FileService fileService; public void ordererRemove(Map removedOrdererHostConfig, InitConfigEntity configEntity) { - log.info("主节点启动 cli 容器"); + // log.info("主节点启动 cli 容器"); + log.info("The master node starts the cli container"); // 启动一个 cli 容器 if (!fabricCliService.createCliContainer(modeService.getInstallPath() + "cli", configEntity)) { - log.error("创建cli容器失败"); + // log.error("创建cli容器失败"); + log.error("Failed to create cli container"); return; } // 收集所有节点加入的通道 - log.info("获取所有节点加入的通道列表"); + // log.info("获取所有节点加入的通道列表"); + log.info("Get channel list belongs to all joined nodes"); Set channelList = new HashSet<>(); try { channelList.addAll(fabricCliService.getAllChannels(configEntity)); } catch (IOException e) { - log.error("获取节点加入的所有通道异常", e); + // log.error("获取节点加入的所有通道异常", e); + log.error("Abnormal error when getting the channel list belonging to all the joined nodes", e); e.printStackTrace(); } - log.info("缩容orderer-获取的通道列表:" + JSON.toJSONString(channelList)); - log.info("修改网络配置"); + // log.info("缩容orderer-获取的通道列表:" + JSON.toJSONString(channelList)); + // log.info("修改网络配置"); + log.info("Reduce orderer - Obtained channel list:" + JSON.toJSONString(channelList)); + log.info("Modify network configuration"); Map oldOrdererConfig = configEntity.getOrdererHostConfig(); oldOrdererConfig.putAll(removedOrdererHostConfig); for (String host : removedOrdererHostConfig.keySet()) { - log.info("缩容orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); + // log.info("缩容orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); + log.info("Reduce orderer-oldOrdererConfig=" + JSON.toJSONString(oldOrdererConfig)); oldOrdererConfig.remove(host); // 修改网络配置 - log.info("将移除的 orderer(s) 从系统通道中移除"); + // log.info("将移除的 orderer(s) 从系统通道中移除"); + log.info("Remove the stopped orderer(s) from the system channel"); // 先修改系统通道 if (!updateService.updateNetworkConfig(configEntity.getNetwork() + "-sys-channel", configEntity, oldOrdererConfig)) { - log.error(String.format("为系统通道 %s 更新网络配置失败", configEntity.getNetwork() + "-sys-channel")); + // log.error(String.format("为系统通道 %s 更新网络配置失败", configEntity.getNetwork() + "-sys-channel")); + log.error(String.format("Failed to update network configuration for system channel %s", configEntity.getNetwork() + "-sys-channel")); return; } channelList.remove(configEntity.getNetwork() + "-sys-channel"); for (String channelName : channelList) { - log.info(String.format("将移除的 orderer(s) 从通道 %s 中移除", channelName)); + // log.info(String.format("将移除的 orderer(s) 从通道 %s 中移除", channelName)); + log.info(String.format("Remove the removed orderer(s) from channel %s", channelName)); if (!updateService.updateNetworkConfig(channelName, configEntity, oldOrdererConfig)) { - log.error(String.format("为通道 %s 更新网络配置失败", channelName)); + // log.error(String.format("为通道 %s 更新网络配置失败", channelName)); + log.error(String.format("Failed to update network configuration for channel %s", channelName)); } } } - - log.info("移除主节点目录下的证书"); + // log.info("移除主节点目录下的证书"); + log.info("Delete the certificate in the master node directory"); fileService.removeCertFile(RoleEnum.ORDER, configEntity, removedOrdererHostConfig, true); - log.info("移除 orderer(s) 节点"); + // log.info("移除 orderer(s) 节点"); + log.info("Remove orderer(s) node"); removeOrdererContainer(removedOrdererHostConfig, configEntity); - log.info("将已移除的 orderer(s) 节点从数据库中删除"); + // log.info("将已移除的 orderer(s) 节点从数据库中删除"); + log.info("Remove the removed orderer(s) node from the database"); // 从数据库中删除 for (String host : removedOrdererHostConfig.keySet()) { String ip = removedOrdererHostConfig.get(host); @@ -129,7 +142,8 @@ public class OrdererRemoveBiz { try { this.checkPointDb.deleteNodeRecord(nodeDO); } catch (SQLException e) { - log.error(String.format("将节点 %s 从数据库中删除异常", host), e); + // log.error(String.format("将节点 %s 从数据库中删除异常", host), e); + log.error(String.format("Exception when deleting node %s from database", host), e); e.printStackTrace(); } } @@ -162,12 +176,12 @@ public class OrdererRemoveBiz { try { FileUtils.copyFile(new File(stopNodeFilePath), new File(modeService.getInstallPath() + "stopNode.sh")); } catch (Exception e) { - log.info("复制stopNode.sh发生异常"); + // log.info("复制stopNode.sh发生异常"); + log.info("An exception occurred while copying stopNode.sh"); return; } updateService.removeNode(RoleEnum.ORDER, peerRemoveCmd.getOrdererDomain(), peerRemoveCmd.getHostNames(), peerRemoveCmd.getPorts()); } else { - String stopFilePath = modeService.getInitDir() + "template/stopNode.sh"; String url = "http://" + ip + ":8080/v1/install/remove"; do { @@ -180,9 +194,11 @@ public class OrdererRemoveBiz { } } - log.warn(String.format("给节点 %s 发送移除命令返回失败,稍后重试", ip)); + // log.warn(String.format("给节点 %s 发送移除命令返回失败,稍后重试", ip)); + log.warn(String.format("Failed to send remove command to node %s, try again later", ip)); } catch (Exception e) { - log.warn(String.format("给节点 %s 发送移除命令异常,稍后重试", ip), e); + // log.warn(String.format("给节点 %s 发送移除命令异常,稍后重试", ip), e); + log.warn(String.format("Exception occurred when sending remove command to node %s, try again later", ip), e); e.printStackTrace(); } @@ -195,5 +211,4 @@ public class OrdererRemoveBiz { } } } - } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerExtendBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerExtendBiz.java index 8f357562..22c126d7 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerExtendBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerExtendBiz.java @@ -81,26 +81,33 @@ public class PeerExtendBiz { public void peerExtend(Map diffPeerHostConfig, InitConfigEntity configEntity) { //在主节点修改crypto-config.yaml文件,添加新节点hostname,编写生成证书命令行,参数extend,执行命令生成新节点证书,生成新增节点的compose文件 //在crypto-config配置文件添加新节点hostName,调用generate.sh生成新节点证书 - log.info("在crypto-config配置文件添加新节点hostName,调用generate.sh生成新节点证书"); + // log.info("在crypto-config配置文件添加新节点hostName,调用generate.sh生成新节点证书"); + log.info("Add a new node hostName in the crypto-config configuration file, run generate.sh to generate a new node certificate"); /*initializer.reCreateNewPeerConfigFile(configEntity);*/ fabricConfigGen.cryptoGen(configEntity); configFileGen.createExtendCerts(); //生成新节点的docker-compose文件 - log.info("生成新节点的docker-compose文件"); + // log.info("生成新节点的docker-compose文件"); + log.info("Generate a docker-compose file for the new node"); Map> peerHostGroup = dockerConfigGen.groupHostByIp(diffPeerHostConfig); Map ipPathMap = this.createNewPeerDockerFile(configEntity, peerHostGroup); //将新生成的证书拷贝到主节点安装目录 - log.info("将新生成的证书拷贝到主节点安装目录"); + // log.info("将新生成的证书拷贝到主节点安装目录"); + log.info("Copy the newly generated certificate to the master node installation directory"); fileService.masterCopyCryptoConfig(); - log.info("注册新Peer节点角色"); + // log.info("注册新Peer节点角色"); + log.info("Register a new Peer node role"); List ports = this.registerNewPeerRole(peerHostGroup); - log.info("推送新peer的安装文件"); + // log.info("推送新peer的安装文件"); + log.info("Send new peer installation file"); this.sendNewPeerFile(ipPathMap, configEntity); //启动新节点 - log.info("启动新新增peer"); + // log.info("启动新新增peer"); + log.info("Run the new peer node"); List serverList = this.startNewPeer(ipPathMap, ports, configEntity); - log.info("等待所有 peer 启动成功"); + // log.info("等待所有 peer 启动成功"); + log.info("Wait for all peer nodes to start successfully"); while (serverList.stream().anyMatch(s -> s.getStatus() != InstallStatusEnum.SUCCESS)) { try { Thread.sleep(5000); @@ -110,13 +117,16 @@ public class PeerExtendBiz { } // 将新节点的域名更新到cli所在宿主机的host // 在宿主机防火墙中打开新节点的端口 - log.info("将新节点的域名写入到hosts,在防火墙中开启新节点端口"); + // log.info("将新节点的域名写入到hosts,在防火墙中开启新节点端口"); + log.info("Write the domain name of the new node to the hosts, and open the new node port in the firewall"); environmentService.updateNewPeerHostPort(diffPeerHostConfig); // 启动一个 cli 容器 - log.info("主节点创建cli容器"); + // log.info("主节点创建cli容器"); + log.info("The master node creates a cli container"); if (!fabricCliService.createCliContainer(modeService.getInstallPath() + "cli", configEntity)) { - log.error("创建cli容器失败"); + // log.error("创建cli容器失败"); + log.error("Failed to create cli container"); return; } @@ -130,12 +140,15 @@ public class PeerExtendBiz { //新节点加入链 if (!CollectionUtils.isEmpty(channelList)) { - log.info("新增节点加入链"); + // log.info("新增节点加入链"); + log.info("New node joins the chain"); Set joinChannels = newPeerJoinChannel(configEntity, diffPeerHostConfig, channelList); - log.info("新增节点加入链-joinChannels=" + JSON.toJSONString(joinChannels)); + // log.info("新增节点加入链-joinChannels=" + JSON.toJSONString(joinChannels)); + log.info("New node joins the chain - joinChannels=" + JSON.toJSONString(joinChannels)); } - log.info("将新 peer(s) 信息加入本地数据库"); + // log.info("将新 peer(s) 信息加入本地数据库"); + log.info("Add the new peer(s) node information to the local database"); // 更新数据库 for (String host : diffPeerHostConfig.keySet()) { String ip = diffPeerHostConfig.get(host); @@ -153,11 +166,11 @@ public class PeerExtendBiz { try { this.checkPointDb.addNodeRecord(nodeDO); } catch (SQLException e) { - log.error(String.format("添加新 peer 节点 %s 记录到数据库异常", host), e); + // log.error(String.format("添加新 peer 节点 %s 记录到数据库异常", host), e); + log.error(String.format("An exception occurred while recording the new peer node %s to the database", host), e); e.printStackTrace(); } } - } private List registerNewPeerRole(Map> peerHostGroup) { @@ -182,12 +195,14 @@ public class PeerExtendBiz { fileService.copyFiles(RoleEnum.PEER, ip, folderName, modeService.getInstallPath(), folderName, configEntity, null); this.rolesBiz.setServerStatus(ip, InstallStatusEnum.DOWNLOADED); } else { - log.info("为新增 peer 打包安装包"); + // log.info("为新增 peer 打包安装包"); + log.info("Package the installation package for the newly added peer node"); String packFilePath = fileService.packExtendNodeFiles(ip, folderName, RoleEnum.PEER, configEntity); // 发送到节点启动 - log.info("将生成的文件包发送到新增 peer 节点"); + // log.info("将生成的文件包发送到新增 peer 节点"); + log.info("Send the generated file package to the newly added peer node"); remoteService.pushSlaveInstallPackage(ip, packFilePath, configEntity); } } @@ -196,7 +211,8 @@ public class PeerExtendBiz { private List startNewPeer(Map ipPathMap, List ports, InitConfigEntity configEntity) { List serverList = this.rolesBiz.getRolesMap().get(RoleEnum.PEER); for (String ip : ipPathMap.keySet()) { - log.info(String.format("发送安装命令到新增 peer 节点 %s", ip)); + // log.info(String.format("发送安装命令到新增 peer 节点 %s", ip)); + log.info(String.format("Send installation command to the newly added peer node %s", ip)); String path = ipPathMap.get(ip); @@ -215,12 +231,14 @@ public class PeerExtendBiz { do { HttpInstallResponse response = remoteService.sendInstallCommand(server, RoleEnum.PEER, folderName, configEntity); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.warn(String.format("发送安装指令给 %s 节点安装 peer 成功", ip)); + // log.warn(String.format("发送安装指令给 %s 节点安装 peer 成功", ip)); + log.warn(String.format("Send installation instructions to %s, successful installation of peer node", ip)); this.rolesBiz.setServerStatus(ip, InstallStatusEnum.INSTALLING); break; } - log.warn(String.format("发送安装指令给 %s 节点安装 peer 失败,稍后重试...", ip)); + // log.warn(String.format("发送安装指令给 %s 节点安装 peer 失败,稍后重试...", ip)); + log.warn(String.format("Send installation instruction to %s, failed to install peer node, try again later...", ip)); try { Thread.sleep(3000); } catch (InterruptedException e) { @@ -260,7 +278,8 @@ public class PeerExtendBiz { FileUtils.copyFile(new File(modeService.getInitDir() + "template/newPeerJoinChannel.sh"), new File(modeService.getInstallPath() + "cli/scripts/newPeerJoinChannel.sh")); ProcessUtil.Result result = ProcessUtil.execCmd(cmd, null, modeService.getInstallPath() + "cli"); } catch (Exception e) { - log.error("执行 docker 脚本异常", e); + // log.error("执行 docker 脚本异常", e); + log.error("An exception occurred while executing the docker script", e); e.printStackTrace(); } } @@ -279,7 +298,8 @@ public class PeerExtendBiz { Set selectChannels = new HashSet<>(); Map selectChannelIndexMap = new HashMap<>(16); //选择需要加入的业务链 - System.out.println("请根据以下列表,选择扩容peer需要加入的业务链。"); + // System.out.println("请根据以下列表,选择扩容peer需要加入的业务链。"); + System.out.println("Please select the business chain that the expanded peer node needs to join according to the following list"); StringBuilder builder = new StringBuilder(); int nextLine = 1; for (String channel : queryChannelList) { @@ -296,17 +316,20 @@ public class PeerExtendBiz { } System.out.println(builder.toString()); Scanner sc = new Scanner(System.in); - System.out.print("请输入需要加入的链名编号(多于一个编号时以“,”分割,请回车后输入):"); + // System.out.print("请输入需要加入的链名编号(多于一个编号时以“,”分割,请回车后输入):"); + System.out.print("Please enter the chain name number to be added (if more than one number is divided by ",", please enter after entering):"); String inputIndexList = ""; if (sc.hasNextLine()) { inputIndexList = sc.nextLine(); - System.out.println("用户输入" + inputIndexList); + // System.out.println("用户输入" + inputIndexList); + System.out.println("User input" + inputIndexList); } sc.close(); if (StringUtils.isEmpty(inputIndexList)) { - log.info("扩容节点——用户输入为空,默认加入本机构的所有业务链"); + // log.info("扩容节点——用户输入为空,默认加入本机构的所有业务链"); + log.info("Expansion node -- User input is empty, default to join all business chains of the institution"); selectChannels.addAll(queryChannelList); selectChannels.remove(""); } else { diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerRemoveBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerRemoveBiz.java index d72c3846..e041a233 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerRemoveBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/PeerRemoveBiz.java @@ -72,7 +72,8 @@ public class PeerRemoveBiz { public void peerRemove(Map removedPeerHostConfig, InitConfigEntity configEntity) { // 通知移除的 peer 节点停止并删除相关文件 - log.info("移除节点停止peer容器"); + // log.info("移除节点停止peer容器"); + log.info("Remove the node to stop the peer container"); Map> removeGroup = dockerConfigGen.groupHostByIp(removedPeerHostConfig); String stopNodeFilePath = (this.initDir.endsWith(File.separator) ? this.initDir : this.initDir + File.separator) + "template/stopNode.sh"; for (String ip : removeGroup.keySet()) { @@ -82,7 +83,8 @@ public class PeerRemoveBiz { try { FileUtils.copyFile(new File(stopNodeFilePath), new File(modeService.getInstallPath() + "stopNode.sh")); } catch (Exception e) { - log.info("复制stopNode.sh发生异常"); + // log.info("复制stopNode.sh发生异常"); + log.info("An exception occurred while copying the stopNode.sh file"); return; } updateService.removeNode(RoleEnum.PEER, peerRemoveCmd.getPeerDomain(), peerRemoveCmd.getHostNames(), peerRemoveCmd.getPorts()); @@ -100,9 +102,11 @@ public class PeerRemoveBiz { } } - log.warn(String.format("给节点 %s 发送移除命令返回失败,稍后重试", ip)); + // log.warn(String.format("给节点 %s 发送移除命令返回失败,稍后重试", ip)); + log.warn(String.format("Failed when sending delete command to node %s, try again later", ip)); } catch (Exception e) { - log.warn(String.format("给节点 %s 发送移除命令异常,稍后重试", ip), e); + // log.warn(String.format("给节点 %s 发送移除命令异常,稍后重试", ip), e); + log.warn(String.format("An exception occurred while sending a remove command to node %s, try again later", ip), e); e.printStackTrace(); } @@ -115,10 +119,12 @@ public class PeerRemoveBiz { } } //将主节点相关证书删除 - log.info("将主节点相关证书删除"); + // log.info("将主节点相关证书删除"); + log.info("Delete the certificate of the master node"); fileService.removeCertFile(RoleEnum.PEER, configEntity, removedPeerHostConfig, true); // 更新本地数据库 - log.info("将已移除的 peer(s) 节点从数据库中删除"); + // log.info("将已移除的 peer(s) 节点从数据库中删除"); + log.info("Delete the removed peer(s) node from the database"); // 从数据库中删除 for (String host : removedPeerHostConfig.keySet()) { String ip = removedPeerHostConfig.get(host); @@ -135,11 +141,10 @@ public class PeerRemoveBiz { try { this.checkPointDb.deleteNodeRecord(nodeDO); } catch (SQLException e) { - log.error(String.format("将节点 %s 从数据库中删除异常", host), e); + // log.error(String.format("将节点 %s 从数据库中删除异常", host), e); + log.error(String.format("An exception occurred while deleting node %s from the database", host), e); e.printStackTrace(); } } } - - } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/UpdateNetworkBiz.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/UpdateNetworkBiz.java index 9ffa7b28..f0000596 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/UpdateNetworkBiz.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/biz/UpdateNetworkBiz.java @@ -62,7 +62,8 @@ public class UpdateNetworkBiz implements InstallMode { && CollectionUtils.isEmpty(removedNodeConfigs.getPeerHostConfig()) && CollectionUtils.isEmpty(addedNodeConfigs.getOrdererHostConfig()) && CollectionUtils.isEmpty(addedNodeConfigs.getPeerHostConfig()))) { - log.info("未发现与上次安装的差异,无需安装任何节点"); + // log.info("未发现与上次安装的差异,无需安装任何节点"); + log.info("Did not find the difference from the last installation, no need to install any node"); return; } doRemoveNodes(removedNodeConfigs, configEntity); @@ -176,7 +177,8 @@ public class UpdateNetworkBiz implements InstallMode { try { return this.checkPointDb.find(nodeDO); } catch (SQLException e) { - log.error("查询数据库异常", e); + // log.error("查询数据库异常", e); + log.error("Exception when querying the database", e); e.printStackTrace(); } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/ConfigFileGen.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/ConfigFileGen.java index 99bed7f0..eb1a1653 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/ConfigFileGen.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/ConfigFileGen.java @@ -38,42 +38,51 @@ public class ConfigFileGen { @Autowired private FabricConfigGen fabricConfigGen; - public void createConfigFile(InitConfigEntity config) { // 生成 configtx.yaml 文件,其它机构在profile中只有PrivateChannel配置,需在子类具体实现 if (fabricConfigGen.configTxGen(config)) { - log.info("生成 configtx.yaml 文件成功"); + // log.info("生成 configtx.yaml 文件成功"); + log.info("the configtx.yaml file was generated successfully"); } else { - log.error("生成 configtx.yaml 文件失败"); + // log.error("生成 configtx.yaml 文件失败"); + log.error("Failed to generate configtx.yaml file"); } // 生成 crypto-config.yaml 文件 if (fabricConfigGen.cryptoGen(config)) { - log.info("生成 crypto-config.yaml 文件成功"); + // log.info("生成 crypto-config.yaml 文件成功"); + log.info("the crypto-config.yaml file was generated successfully"); } else { - log.error("生成 crypto-config.yaml 文件失败"); + // log.error("生成 crypto-config.yaml 文件失败"); + log.error("Failed to generate crypto-config.yaml file"); } // 创建 crypto-config 目录和证书 if (createNewCerts()) { - log.info("创建证书成功"); + // log.info("创建证书成功"); + log.info("Successfully created certificate"); } else { - log.error("创建证书失败"); + // log.error("创建证书失败"); + log.error("Failed to create certificate"); } // 生成 orderer docker compose yaml 文件 if (dockerConfigGen.ordererComposeFileGen(config)) { - log.info("生成 docker-compose-orderer.yaml 文件成功"); + // log.info("生成 docker-compose-orderer.yaml 文件成功"); + log.info("the docker-compose-orderer.yaml file was generated successfully"); } else { - log.error("生成 docker-compose-orderer.yaml 文件失败"); + // log.error("生成 docker-compose-orderer.yaml 文件失败"); + log.error("Failed to generate docker-compose-orderer.yaml file"); } // 生成 peer docker compose yaml 文件,本配置文件不区分发起机构与其他机构,可具体实现 if (dockerConfigGen.peerComposeFileGen(config)) { - log.info("生成 docker-compose-peer.yaml 文件成功"); + // log.info("生成 docker-compose-peer.yaml 文件成功"); + log.info("the docker-compose-peer.yaml file was generated successfully"); } else { - log.error("生成 docker-compose-peer.yaml 文件失败"); + // log.error("生成 docker-compose-peer.yaml 文件失败"); + log.error("Failed to generate docker-compose-peer.yaml file"); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/DockerConfigGenImpl.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/DockerConfigGenImpl.java index 74a2a214..54fbde43 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/DockerConfigGenImpl.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/DockerConfigGenImpl.java @@ -281,7 +281,8 @@ public class DockerConfigGenImpl implements DockerConfigGen { if (!CollectionUtils.isEmpty(otherPeerHosts)) { for (String otherHost : otherPeerHosts) { String host = otherHost.split(":")[0]; - log.info("扩容节点其他节点的host:" + host); + // log.info("扩容节点其他节点的host:" + host); + log.info("Hosts of other nodes in the expansion node:" + host); String origIp = initConfig.getPeerHostConfig().get(host); if (origIp.contains("127.0.0.1")) { origIp = NetUtil.getMyNormalIP() + ":" + origIp.split(":")[1]; @@ -470,7 +471,8 @@ public class DockerConfigGenImpl implements DockerConfigGen { FileUtil.makeFilePath(filePath, false); String yamlFilePath = filePath + "docker-compose-peer.yaml"; - log.info("新节点生成docker-compose文件路径:" + yamlFilePath); + // log.info("新节点生成docker-compose文件路径:" + yamlFilePath); + log.info("The path of the docker-compose file generated by the new node:" + yamlFilePath); if (!yamlFileService.writeObjectToYamlFile(peerComposeConfig, yamlFilePath)) { return null; diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/FabricConfigGenImpl.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/FabricConfigGenImpl.java index 9381e289..25b1ee47 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/FabricConfigGenImpl.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/config/configGenImpl/FabricConfigGenImpl.java @@ -195,7 +195,8 @@ public class FabricConfigGenImpl implements FabricConfigGen { try { result = yamlFileService.loadYamlFile(txTempFile); } catch (FileNotFoundException e) { - log.error("找不到指定文件,文件路径:" + txTempFile); + // log.error("找不到指定文件,文件路径:" + txTempFile); + log.error("Cannot find the specified file, file path:" + txTempFile); e.printStackTrace(); } return result; @@ -247,5 +248,4 @@ public class FabricConfigGenImpl implements FabricConfigGen { } return writeYamlFile(cryptoConfig, CRYPTO); } - } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/EnvironmentService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/EnvironmentService.java index e5ffe1fa..15241cd5 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/EnvironmentService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/EnvironmentService.java @@ -89,11 +89,13 @@ public class EnvironmentService { return; } - log.info(String.format("写入 hosts 文件: %s", JSONObject.toJSONString(hosts))); + // log.info(String.format("写入 hosts 文件: %s", JSONObject.toJSONString(hosts))); + log.info(String.format("Write to hosts file: %s", JSONObject.toJSONString(hosts))); try { String hostContent = FileUtil.getFileContent("/etc/hosts"); - log.info("写入 hosts 文件,hostContent=" + hostContent); + // log.info("写入 hosts 文件, hostContent=" + hostContent); + log.info("write to hosts file, hostContent=" + hostContent); String[] hostConfigArray = hostContent.split("\n"); @@ -116,14 +118,16 @@ public class EnvironmentService { if (!append) { oldHostBuilder.append(String.join("\n", hostConfigArray)); - log.info("写入 hosts 文件,hostConfigArray.build=" + oldHostBuilder.toString()); + // log.info("写入 hosts 文件,hostConfigArray.build=" + oldHostBuilder.toString()); + log.info("write to hosts file, hostConfigArray.build=" + oldHostBuilder.toString()); } oldHostBuilder.append(newHostBuilder); FileOutputStream fos = new FileOutputStream(new File("/etc/hosts"), append); fos.write(oldHostBuilder.toString().getBytes()); fos.close(); } catch (IOException e) { - log.error("写入/etc/hosts文件异常", e); + // log.error("写入/etc/hosts文件异常", e); + log.error("An exception occurred while writing to the /etc/hosts file", e); e.printStackTrace(); } @@ -131,7 +135,8 @@ public class EnvironmentService { if (ports.stream().noneMatch("2375"::equals)) { ports.add("2375"); } - log.info(String.format("端口加入防火墙: %s", ports.stream().collect(Collectors.joining(",")))); + // log.info(String.format("端口加入防火墙: %s", ports.stream().collect(Collectors.joining(",")))); + log.info(String.format("Add the port to the firewall: %s", ports.stream().collect(Collectors.joining(",")))); for (String port : ports) { addPortIntoFirewall(port); } @@ -147,7 +152,8 @@ public class EnvironmentService { succ = true; } } catch (Exception e) { - log.error("调用 firewall-cmd 添加端口异常", e); + // log.error("调用 firewall-cmd 添加端口异常", e); + log.error("An exception occurred when running firewall-cmd to add a port", e); e.printStackTrace(); } @@ -159,7 +165,8 @@ public class EnvironmentService { ProcessUtil.execCmd("service iptables save", null, "./"); } } catch (Exception e) { - log.error("调用 iptables 添加端口异常", e); + // log.error("调用 iptables 添加端口异常", e); + log.error("An exception occurred when calling iptables to add a port", e); e.printStackTrace(); } } @@ -188,7 +195,8 @@ public class EnvironmentService { succ = true; } } catch (Exception e) { - log.error("调用 firewall-cmd 添加端口异常", e); + // log.error("调用 firewall-cmd 添加端口异常", e); + log.error("An exception occurred when running firewall-cmd to add a port", e); e.printStackTrace(); } @@ -200,7 +208,8 @@ public class EnvironmentService { ProcessUtil.execCmd("service iptables save", null, "./"); } } catch (Exception e) { - log.error("调用 iptables 添加端口异常", e); + // log.error("调用 iptables 添加端口异常", e); + log.error("An exception occurred when calling iptables to add a port", e); e.printStackTrace(); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FabricCliService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FabricCliService.java index 7e94f0e3..8f22e529 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FabricCliService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FabricCliService.java @@ -83,7 +83,8 @@ public class FabricCliService { FileUtils.copyFile(new File("/var/run/genesis.block"), new File(modeService.getInstallPath() + "channel-artifacts" + File.separator + "genesis.block")); FileUtils.copyFile(new File("/var/run/genesis.block"), initPathGenesisFile); } catch (Exception e) { - log.error(String.format("执行脚本获取通道 %s 配置异常", CHANNEL_NAME), e); + // log.error(String.format("执行脚本获取通道 %s 配置异常", CHANNEL_NAME), e); + log.error(String.format("An exception occurred while executing the script to get the configuration of channel %s", CHANNEL_NAME), e); e.printStackTrace(); return false; } @@ -134,7 +135,8 @@ public class FabricCliService { } } } catch (Exception e) { - log.error("执行 docker 脚步获取通道异常", e); + // log.error("执行 docker 脚步获取通道异常", e); + log.error("An exception occurred while executing docker steps to get the channel", e); e.printStackTrace(); } } @@ -158,11 +160,13 @@ public class FabricCliService { try { if (!this.createCliYamlFile(destFilePath, initConfigEntity)) { - log.error("创建cli容器相关文件失败"); + // log.error("创建cli容器相关文件失败"); + log.error("Failed to create files related to cli container"); return false; } } catch (IOException e) { - log.error("创建cli容器相关文件异常", e); + // log.error("创建cli容器相关文件异常", e); + log.error("An exception occurred while creating the cli container related file", e); e.printStackTrace(); return false; @@ -171,11 +175,13 @@ public class FabricCliService { try { ProcessUtil.Result result = ProcessUtil.execCmd("bash " + destFilePath + "start-peer.sh startCli", null, destFilePath); if (result.getCode() == 0) { - log.info("启动 cli 容器成功"); + // log.info("启动 cli 容器成功"); + log.info("Successfully started cli container"); return true; } } catch (Exception e) { - log.error("执行启动 cli 容器的脚步异常", e); + // log.error("执行启动 cli 容器的脚本异常", e); + log.error("An exception occurred while executing the script of the cli container", e); e.printStackTrace(); } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FileService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FileService.java index 6bb8b796..b7297227 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FileService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/FileService.java @@ -105,7 +105,8 @@ public class FileService { case ORDER: String orderDir = dockerSrcFile + (StringUtils.isEmpty(srcFolderName) ? "order-" + ip : srcFolderName); if (!new File(orderDir).exists()) { - log.info(String.format("目录 %s 不存在", orderDir)); + // log.info(String.format("目录 %s 不存在", orderDir)); + log.info(String.format("Directory %s does not exist", orderDir)); break; } FileUtils.copyDirectory(new File(orderDir), new File(destPath + (StringUtils.isEmpty(destFolderName) ? "order" : destFolderName))); @@ -118,14 +119,16 @@ public class FileService { case PEER: String peerDir = dockerSrcFile + (StringUtils.isEmpty(srcFolderName) ? "peer-" + ip : srcFolderName); if (!new File(peerDir).exists()) { - log.info(String.format("目录 %s 不存在", peerDir)); + // log.info(String.format("目录 %s 不存在", peerDir)); + log.info(String.format("Directory %s does not exist", peerDir)); break; } FileUtils.copyDirectory(new File(peerDir), new File(destPath + (StringUtils.isEmpty(destFolderName) ? "peer" : destFolderName))); break; } } catch (Exception e) { - log.error(String.format("为 %s 复制 %s 角色文件失败", ip, role.name()), e); + // log.error(String.format("为 %s 复制 %s 角色文件失败", ip, role.name()), e); + log.error(String.format("Failed to copy %s role files for %s", role.name(), ip), e); e.printStackTrace(); } } @@ -138,7 +141,8 @@ public class FileService { * @param destPath */ public void copyCertFiles(RoleEnum role, String ip, String destPath, InitConfigEntity configEntity) { - log.info(String.format("为服务器 %s 角色 %s 复制证书文件, 目标目录: %s", ip, role.name(), destPath)); + // log.info(String.format("为服务器 %s 角色 %s 复制证书文件, 目标目录: %s", ip, role.name(), destPath)); + log.info(String.format("Copy certificate file for server %s role %s, target directory: %s", ip, role.name(), destPath)); if (!destPath.endsWith(File.separator)) { destPath = destPath + File.separator; @@ -173,7 +177,8 @@ public class FileService { try { FileUtils.copyDirectory(new File(srcDir), new File(certRootPath + relativePath)); } catch (IOException e) { - log.error(String.format("复制%s证书文件异常", role.name()), e); + // log.error(String.format("复制%s证书文件异常", role.name()), e); + log.error(String.format("An exception occurred while copying the %s certificate file", role.name()), e); e.printStackTrace(); } } @@ -189,7 +194,8 @@ public class FileService { try { FileUtils.copyDirectory(new File(srcDir), new File(modeService.getInstallPath() + "crypto-config")); } catch (IOException e) { - log.error("主节点复制证书文件异常", e); + // log.error("主节点复制证书文件异常", e); + log.error("An exception occurred when the master node copied the certificate file", e); e.printStackTrace(); } } @@ -198,16 +204,19 @@ public class FileService { * 将configtx.yaml文件复制到主节点 */ public void masterCopyConfigtxFile() { - log.info("复制 configtx.yaml 文件到安装目录"); + // log.info("复制 configtx.yaml 文件到安装目录"); + log.info("Copy the configtx.yaml file to the installation directory"); FileUtil.makeFilePath(modeService.getInstallPath(), false); String srcRootPath = FileUtil.reviseDir(modeService.getInitDir()); String srcFile = srcRootPath + "fabric-net" + File.separator + "cryptoAndConfig" + File.separator + "configtx.yaml"; try { - log.info("生成创世快-从" + srcFile + "复制到" + modeService.getInstallPath() + "configtx.yaml"); + // log.info("生成创世块-从" + srcFile + "复制到" + modeService.getInstallPath() + "configtx.yaml"); + log.info("Generate genesis block - from" + srcFile + "copy to" + modeService.getInstallPath() + "configtx.yaml"); FileUtils.copyFile(new File(srcFile), new File(modeService.getInstallPath() + "configtx.yaml")); } catch (IOException e) { - log.error("复制 configtx.yaml 文件到安装目录异常", e); + // log.error("复制 configtx.yaml 文件到安装目录异常", e); + log.error("An exception occurred when copying the configtx.yaml file to the installation directory", e); e.printStackTrace(); } } @@ -220,14 +229,16 @@ public class FileService { * @return */ public String packInstallFiles(String serverAddress, List roleList, InitConfigEntity configEntity) { - log.info(String.format("为服务器 %s 准备智能安装包, 该服务器承担的角色:%s", serverAddress, roleList.stream().map(Enum::name).collect(Collectors.joining(",")))); + // log.info(String.format("为服务器 %s 准备智能安装包, 该服务器承担的角色:%s", serverAddress, roleList.stream().map(Enum::name).collect(Collectors.joining(",")))); + log.info(String.format("Prepare a smart installation package for server %s, the role assumed by this server is: %s", serverAddress, roleList.stream().map(Enum::name).collect(Collectors.joining(",")))); if (configEntity == null) { try { Yaml yaml = new Yaml(); configEntity = yaml.loadAs(new FileInputStream(new File(this.initConfigFile)), InitConfigEntity.class); } catch (Exception e) { - log.error("安装过程发生异常", e); + // log.error("安装过程发生异常", e); + log.error("An exception occurred during the installation process", e); e.printStackTrace(); } } @@ -258,7 +269,8 @@ public class FileService { return packFilePath; } catch (IOException e) { - log.error("生成智能安装包时异常", e); + // log.error("生成智能安装包时异常", e); + log.error("Exception when generating smart installation package", e); e.printStackTrace(); } @@ -284,7 +296,8 @@ public class FileService { role = "orderer"; break; } - log.info(String.format("为新 %s 节点 %s 准备智能安装包", role, serverAddress)); + // log.info(String.format("为新 %s 节点 %s 准备智能安装包", role, serverAddress)); + log.info(String.format("Prepare smart installation package for new %s node %s", role, serverAddress)); // 建一个临时目录 String tmpPath = System.getProperty("java.io.tmpdir"); @@ -311,7 +324,8 @@ public class FileService { return packFilePath; } catch (IOException e) { - log.error("生成智能安装包时异常", e); + // log.error("生成智能安装包时异常", e); + log.error("Exception when generating smart installation package", e); e.printStackTrace(); } @@ -346,7 +360,8 @@ public class FileService { rmPath = modeService.getInstallPath() + ordererCertPath; } } - log.info("缩容节点,移除证书路径:" + rmPath); + // log.info("缩容节点,移除证书路径:" + rmPath); + log.info("Reduce nodes, remove certificate path: " + rmPath); FileUtil.rmFile(new File(rmPath)); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InitConfigService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InitConfigService.java index 9e3f8a47..d34e2de8 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InitConfigService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InitConfigService.java @@ -53,7 +53,8 @@ public class InitConfigService { try { initConfigEntity = yaml.loadAs(new FileInputStream(file), InitConfigEntity.class); } catch (Exception e) { - log.error("配置文件读取异常,请检查各配置项是否符合格式要求"); + // log.error("配置文件读取异常,请检查各配置项是否符合格式要求"); + log.error("An exception occurred while reading the configuration file, please check whether each configuration item meets the format requirements"); } return initConfigEntity; } @@ -62,20 +63,24 @@ public class InitConfigService { boolean isCorrect = true; if (!isNotEmptyConfig(initConfigEntity)) { - log.error("配置文件中相关配置项为空"); + // log.error("配置文件中相关配置项为空"); + log.error("The relevant configuration items in the configuration file are empty"); isCorrect = false; } if (!isCorrectFormat(initConfigEntity)) { - log.error("配置文件中相关域名的ip和端口格式不正确"); + // log.error("配置文件中相关域名的ip和端口格式不正确"); + log.error("The ip and port formats of related domain names in the configuration file are incorrect"); isCorrect = false; } if (!isCorrectDomain(initConfigEntity)) { - log.error("配置文件中orderer或peer的域名不匹配"); + // log.error("配置文件中orderer或peer的域名不匹配"); + log.error("The orderer or peer domain names in the configuration file do not match"); isCorrect = false; } if (!checkPeerConfig(initConfigEntity)) { - log.error("配置文件中peer没有配置相应的交易查询端口"); + // log.error("配置文件中peer没有配置相应的交易查询端口"); + log.error("The peer does not configure the relevant transaction query interface in the configuration file"); isCorrect = false; } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InstallService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InstallService.java index 99da241e..27b76fb1 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InstallService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/InstallService.java @@ -96,14 +96,16 @@ public class InstallService { do { HttpInstallResponse response = remoteService.sendInstallCommand(server, role, null, configEntity); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.warn(String.format("发送安装指令给 %s 节点安装 %s 成功", server.getHost(), role.name().toLowerCase())); + // log.warn(String.format("发送安装指令给 %s 节点安装 %s 成功", server.getHost(), role.name().toLowerCase())); + log.warn(String.format("Send installation instructions to %s node to install %s successfully", server.getHost(), role.name().toLowerCase())); server.setStatus(InstallStatusEnum.INSTALLING); break; } if (retryCount == retryTotal) { break; } - log.warn(String.format("发送安装指令给 %s 节点安装 %s 失败,稍后重试...", server.getHost(), role.name().toLowerCase())); + // log.warn(String.format("发送安装指令给 %s 节点安装 %s 失败,稍后重试...", server.getHost(), role.name().toLowerCase())); + log.warn(String.format("Sending installation instructions to %s node failed to install %s, try again later...", server.getHost(), role.name().toLowerCase())); try { Thread.sleep(3000); } catch (InterruptedException e) { @@ -122,7 +124,8 @@ public class InstallService { if (checkCount == checkTotal) { break; } - log.info(String.format("等待所有 %s 节点完成安装...", role.name().toLowerCase())); + // log.info(String.format("等待所有 %s 节点完成安装...", role.name().toLowerCase())); + log.info(String.format("Wait for all %s nodes to complete the installation...", role.name().toLowerCase())); try { Thread.sleep(10000); } catch (InterruptedException e) { @@ -142,7 +145,8 @@ public class InstallService { * @param role */ public boolean startRole(RoleEnum role, List rolePorts, Map hosts, String roleFolderName, String host) { - log.info(String.format("开始执行角色 %s 的脚本", role.name())); + // log.info(String.format("开始执行角色 %s 的脚本", role.name())); + log.info(String.format("Start executing the script code of role %s", role.name())); if (!new File(modeService.getInstallPath()).exists()) { FileUtil.makeFilePath(modeService.getInstallPath(), false); } @@ -168,7 +172,8 @@ public class InstallService { ProcessUtil.Result res = ProcessUtil.execCmd("bash " + shellFilePath, env, workingDir); return res.getCode() == 0; } catch (Exception e) { - log.error(String.format("启动角色%s脚本异常", role.name()), e); + // log.error(String.format("启动角色%s脚本异常", role.name()), e); + log.error(String.format("An exception occurred while executing script code for role %s", role.name()), e); e.printStackTrace(); } } @@ -194,7 +199,8 @@ public class InstallService { } } if (result.isSuccess()) { - log.info(String.format("节点 %s 已完成 %s 角色的安装", remoteAddress, result.getRole().name())); + // log.info(String.format("节点 %s 已完成 %s 角色的安装", remoteAddress, result.getRole().name())); + log.info(String.format("Node %s has completed the installation of %s roles", remoteAddress, result.getRole().name())); // 加入数据库 switch (result.getRole()) { diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/ModeService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/ModeService.java index 3f3a48b5..a3c25685 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/ModeService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/ModeService.java @@ -62,7 +62,6 @@ public class ModeService { return response; } - /** * @return true -- 初始化完成 */ @@ -70,10 +69,12 @@ public class ModeService { String logFilePath = this.getInstallPath() + "bcp-app-mgr-" + host + File.separator + "log.out"; try { ProcessUtil.Result result = ProcessUtil.execCmd("sh ./fetchBackendInit.sh " + logFilePath, null, shPath); - log.info(StringUtils.isEmpty(result.getData()) ? "后台初始化中,请耐心等待............" : "后台初始化成功"); + // log.info(StringUtils.isEmpty(result.getData()) ? "后台初始化中,请耐心等待............" : "后台初始化成功"); + log.info(StringUtils.isEmpty(result.getData()) ? "Please wait patiently during background initialization............" : "Background initialization successful"); return !StringUtils.isEmpty(result.getData()); } catch (Exception e) { - log.error("查询管理后台日志异常", e); + // log.error("查询管理后台日志异常", e); + log.error("An exception occurred while querying the management background log", e); e.printStackTrace(); } @@ -98,7 +99,8 @@ public class ModeService { } } if (result.isSuccess()) { - log.info(String.format("节点 %s 已完成 %s 角色的安装", remoteAddress, result.getRole().name())); + // log.info(String.format("节点 %s 已完成 %s 角色的安装", remoteAddress, result.getRole().name())); + log.info(String.format("Node %s has completed the installation of role %s", remoteAddress, result.getRole().name())); // 加入数据库 switch (result.getRole()) { @@ -131,7 +133,8 @@ public class ModeService { try { this.checkPointDb.addNodeRecord(nodeDO); } catch (SQLException e) { - log.error(String.format("添加节点 %s 角色 %s 到数据库失败", ip, role.name().toLowerCase()), e); + // log.error(String.format("添加节点 %s 角色 %s 到数据库失败", ip, role.name().toLowerCase()), e); + log.error(String.format("Failed when adding role 2 of node 1 to the database", ip, role.name().toLowerCase()), e); e.printStackTrace(); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RemoteService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RemoteService.java index 534801c3..12701fd3 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RemoteService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RemoteService.java @@ -54,7 +54,6 @@ public class RemoteService { @Autowired protected RolesBiz rolesBiz; - /** * 主节点给从节点发送安装指令 * @@ -63,7 +62,8 @@ public class RemoteService { * @return */ public HttpInstallResponse sendInstallCommand(ServerEntity server, RoleEnum role, String folderName, InitConfigEntity configEntity) { - log.info(String.format("主节点给从节点 %s 发送安装角色:%s", server.getHost(), role.name())); + // log.info(String.format("主节点给从节点 %s 发送安装角色:%s", server.getHost(), role.name())); + log.info(String.format("The master node sends the installation role %s to slave node %s", role.name(), server.getHost())); try { Map revisedHosts = new HashMap<>(); Map hosts = environmentService.getRoleNeedSetHost(role, configEntity); @@ -85,13 +85,16 @@ public class RemoteService { //发生安装指令 String result = this.httpClient.sendFileAndJson(server.getHttpUrl() + "/v1/install/start", "", JSONObject.toJSONString(entity)); if (result.isEmpty()) { - log.error("注册角色返回结果为空"); + // log.error("注册角色返回结果为空"); + log.error("The result value returned when registering a role is empty"); } else { - log.info("注册角色返回结果: " + result); + // log.info("注册角色返回结果: " + result); + log.info("The value returned when registering a role is: " + result); return JSON.parseObject(result, HttpInstallResponse.class); } } catch (Exception e) { - log.error("发送安装指令异常", e); + // log.error("发送安装指令异常", e); + log.error("An exception occurred when sending the installation instruction", e); e.printStackTrace(); } @@ -120,7 +123,8 @@ public class RemoteService { if (!StringUtils.isEmpty(result)) { HttpInstallResponse response = JSONObject.parseObject(result, HttpInstallResponse.class); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.info(String.format("向从节点 %s 推送安装包成功", remoteAddr)); + // log.info(String.format("向从节点 %s 推送安装包成功", remoteAddr)); + log.info(String.format("Successfully pushed the installation package to slave node %s", remoteAddr)); this.rolesBiz.setServerStatus(remoteAddr, InstallStatusEnum.DOWNLOADED); break; } @@ -128,7 +132,8 @@ public class RemoteService { if (retryCount == retryTotal) { break; } - log.info(String.format("向从节点 %s 推送安装包失败,稍后重试...", remoteAddr)); + // log.info(String.format("向从节点 %s 推送安装包失败,稍后重试...", remoteAddr)); + log.info(String.format("Failed to push the installation package to slave node %s, try again later...", remoteAddr)); try { Thread.sleep(8000); } catch (Exception e) { @@ -159,15 +164,18 @@ public class RemoteService { if (!StringUtils.isEmpty(result)) { HttpInstallResponse response = JSONObject.parseObject(result, HttpInstallResponse.class); if (ResponseCode.SUCCESS.getCode().equals(response.getCode())) { - log.info(String.format("发送结束指令给 %s 成功", url)); + // log.info(String.format("发送结束指令给 %s 成功", url)); + log.info(String.format("Successfully sent the end command to node %s", url)); break; } } if (retryCount == retryTotal) { - log.info("发送结束指令超时"); + // log.info("发送结束指令超时"); + log.info("Send end command timeout"); break; } - log.info(String.format("发送结束指令给 %s 失败,稍后重试...", url)); + // log.info(String.format("发送结束指令给 %s 失败,稍后重试...", url)); + log.info(String.format("Failed to send end command to node %s, try again later...", url)); try { Thread.sleep(5000); } catch (Exception e) { @@ -176,7 +184,8 @@ public class RemoteService { retryCount++; } while (true); } catch (IOException e) { - log.error(String.format("发送结束指令给 %s 异常", url)); + // log.error(String.format("发送结束指令给 %s 异常", url)); + log.error(String.format("An exception occurred when sending the end command to node %s", url)); e.printStackTrace(); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RoleService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RoleService.java index d3c0d70e..6494e28a 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RoleService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/RoleService.java @@ -46,7 +46,6 @@ public class RoleService { @Autowired protected GlobalConfig globalConfig; - /** * 根据服务器IP地址解析其所担任的角色,并添加到RoleBiz中 * @@ -70,11 +69,13 @@ public class RoleService { * @return 返回 RoleEnum->端口列表 */ public Map> parseAllRoles(String slaveAddress, InitConfigEntity configEntity) { - log.info(String.format("为服务器 %s 解析角色", slaveAddress)); + // log.info(String.format("为服务器 %s 解析角色", slaveAddress)); + log.info(String.format("Resolve roles for server %s", slaveAddress)); Map> roles = new HashMap<>(16); this.parseRole(roles, slaveAddress, configEntity.getOrdererHostConfig(), RoleEnum.ORDER, configEntity); this.parseRole(roles, slaveAddress, configEntity.getPeerHostConfig(), RoleEnum.PEER, configEntity); - log.info(String.format("服务器 %s 解析后,所承担的角色有: ", slaveAddress, roles.keySet().stream().map(Enum::name).collect(Collectors.joining(",")))); + // log.info(String.format("服务器 %s 解析后,所承担的角色有: ", slaveAddress, roles.keySet().stream().map(Enum::name).collect(Collectors.joining(",")))); + log.info(String.format("After parsing by server %s, the assumed roles are: ", slaveAddress, roles.keySet().stream().map(Enum::name).collect(Collectors.joining(",")))); return roles; } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/UpdateService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/UpdateService.java index bfabdce6..5a6123a2 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/UpdateService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/UpdateService.java @@ -101,7 +101,8 @@ public class UpdateService { FileUtils.copyFile(new File(modeService.getInitDir() + "template/create-update-pb.sh"), new File(modeService.getInstallPath() + "cli/scripts/create-update-pb.sh")); FileUtils.copyFile(new File(modeService.getInitDir() + "template/update-channel-config.sh"), new File(modeService.getInstallPath() + "cli/scripts/update-channel-config.sh")); } catch (IOException e) { - log.error("复制脚本文件异常", e); + // log.error("复制脚本文件异常", e); + log.error("An exception occurred while copying the script file", e); e.printStackTrace(); return false; } @@ -121,7 +122,8 @@ public class UpdateService { try { ProcessUtil.execCmd(cmd, null, modeService.getInstallPath() + "cli"); } catch (Exception e) { - log.error(String.format("执行脚本获取通道 %s 配置异常", channelName), e); + // log.error(String.format("执行脚本获取通道 %s 配置异常", channelName), e); + log.error(String.format("An exception occurred while executing the script code to obtain the configuration of channel %s", channelName), e); e.printStackTrace(); return false; } @@ -129,7 +131,8 @@ public class UpdateService { // 修改通道配置: 增加 orderer 相关配置 String filePath = String.format("/var/run/config_%s.json", channelName); if (!new File(filePath).exists()) { - log.error(String.format("通道 %s 配置文件 %s 不存在", channelName, filePath)); + // log.error(String.format("通道 %s 配置文件 %s 不存在", channelName, filePath)); + log.error(String.format("Channel %s configuration file %s does not exist", channelName, filePath)); return false; } JSONObject jsonObject = JSONObject.parseObject(FileUtil.getFileContent(filePath)); @@ -143,7 +146,8 @@ public class UpdateService { String certFilePath = modeService.getInstallPath() + "crypto-config/ordererOrganizations/" + configEntity.getOrdererDomain() + "/orderers/" + oHost + "/tls/server.crt"; if (!new File(certFilePath).exists()) { - log.error(String.format("orderer %s 的证书文件 %s 不存在", oHost, certFilePath)); + // log.error(String.format("orderer %s 的证书文件 %s 不存在", oHost, certFilePath)); + log.error(String.format("Certificate file %s of orderer %s does not exist", certFilePath, oHost)); return false; } @@ -164,7 +168,8 @@ public class UpdateService { File modifiedFile = new File(String.format("/var/run/config_%s_modified.json", channelName)); FileUtil.writeTxtFile(jsonObject.toJSONString(), modifiedFile, "UTF-8"); if (!modifiedFile.exists()) { - log.error(String.format("创建通道 %s 配置编辑文件 %s 失败", channelName, modifiedFile.getAbsolutePath())); + // log.error(String.format("创建通道 %s 配置编辑文件 %s 失败", channelName, modifiedFile.getAbsolutePath())); + log.error(String.format("Failed when creating configuration file %s for channel %s", modifiedFile.getAbsolutePath(), channelName)); return false; } @@ -173,7 +178,8 @@ public class UpdateService { try { ProcessUtil.execCmd(cmd, null, "/var/run"); } catch (Exception e) { - log.error(String.format("为通道 %s 执行脚本生成pb文件异常", channelName), e); + // log.error(String.format("为通道 %s 执行脚本生成pb文件异常", channelName), e); + log.error(String.format("An exception occurred while generating a pb file for the channel %s execution script", channelName), e); e.printStackTrace(); return false; } @@ -182,7 +188,8 @@ public class UpdateService { try { ProcessUtil.execCmd(cmd, null, modeService.getInstallPath() + "cli"); } catch (Exception e) { - log.error(String.format("为通道 %s 执行脚本更新网络配置异常", channelName), e); + // log.error(String.format("为通道 %s 执行脚本更新网络配置异常", channelName), e); + log.error(String.format("An exception occurred while executing a script to update the network configuration for channel %s", channelName), e); e.printStackTrace(); } @@ -195,15 +202,18 @@ public class UpdateService { } for (String host : hostNames) { try { - log.info("移除节点容器:sh stopNode.sh " + host.split(domain)[0]); + // log.info("移除节点容器:sh stopNode.sh " + host.split(domain)[0]); + log.info("Remove node container:sh stopNode.sh " + host.split(domain)[0]); ProcessUtil.execCmd("sh stopNode.sh " + host.split(domain)[0], null, modeService.getInstallPath()); String roleFileName = role == RoleEnum.ORDER ? "ordererOrganizations" : "peerOrganizations"; String nodeFileName = role == RoleEnum.ORDER ? "orderers" : "peers"; String rmCertFile = String.format("crypto-config" + File.separator + "%s" + File.separator + "%s" + File.separator + "%s" + File.separator + "%s", roleFileName, domain, nodeFileName, host); - log.info("移除节点容器证书,路径:" + modeService.getInstallPath() + rmCertFile); + // log.info("移除节点容器证书,路径:" + modeService.getInstallPath() + rmCertFile); + log.info("Remove node container certificate, path:" + modeService.getInstallPath() + rmCertFile); FileUtil.rmFile(new File(modeService.getInstallPath() + rmCertFile)); } catch (Exception e) { - log.error(String.format("移除节点 %s 异常", host), e); + // log.error(String.format("移除节点 %s 异常", host), e); + log.error(String.format("An exception occurred while removing node %s", host), e); e.printStackTrace(); } } diff --git a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/YamlFileService.java b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/YamlFileService.java index ef719cd2..bc9a6096 100644 --- a/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/YamlFileService.java +++ b/distributed-deploy/bcp-install-biz/src/main/java/com/cgb/bcpinstall/service/YamlFileService.java @@ -72,5 +72,4 @@ public class YamlFileService { public Map loadYamlFile(String filePath) throws FileNotFoundException { return new Yaml().loadAs(new FileInputStream(new File(filePath)), Map.class); } - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/annotation/InvokeLog.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/annotation/InvokeLog.java index eb25eaec..7666a879 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/annotation/InvokeLog.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/annotation/InvokeLog.java @@ -47,5 +47,4 @@ public @interface InvokeLog { * @return */ boolean printReturn() default true; - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/constant/LoginConstant.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/constant/LoginConstant.java index c182c695..df313038 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/constant/LoginConstant.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/constant/LoginConstant.java @@ -38,11 +38,8 @@ public abstract class LoginConstant { */ public static final String WL_PROXY_CLIENT_IP = "WL-Proxy-Client-IP"; - public static final String CURRENT_USER_NAME = "current_user_name"; public static final String CURRENT_USER_ID = "current_user_id"; public static final String CURRENT_USER_TOKEN = "current_user_token"; public static final String CURRENT_MSP = "current_msp"; - - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/context/RequestContextHandler.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/context/RequestContextHandler.java index 3abe5d62..5be08c29 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/context/RequestContextHandler.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/context/RequestContextHandler.java @@ -47,7 +47,6 @@ public class RequestContextHandler { } - public static Object get(String key) { Map map = threadLocal.get(); if (null == map) { @@ -62,14 +61,11 @@ public class RequestContextHandler { set(LoginConstant.CURRENT_USER_NAME, userName); } - - public static void setCurrentUserId(String id) { set(LoginConstant.CURRENT_USER_ID, id); } - public static void setCurrentUserToken(String token) { set(LoginConstant.CURRENT_USER_TOKEN, token); @@ -79,12 +75,10 @@ public class RequestContextHandler { return value == null ? null : value.toString(); } - public static void remove() { threadLocal.remove(); } - @RunWith(MockitoJUnitRunner.class) public static class UnitTest { private final Logger logger = LoggerFactory.getLogger(UnitTest.class); @@ -117,7 +111,6 @@ public class RequestContextHandler { logger.info("main thread done"); } - @Test public void TestUser() { RequestContextHandler.setCurrentUserId(111 + ""); @@ -129,6 +122,4 @@ public class RequestContextHandler { } } - - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/AbstractPrintLog.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/AbstractPrintLog.java index 0c6479df..4ee932f7 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/AbstractPrintLog.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/AbstractPrintLog.java @@ -45,7 +45,8 @@ public abstract class AbstractPrintLog { public static final Logger logger = LoggerFactory.getLogger(AbstractPrintLog.class); - private static final String MSG = "\n --请求--\n --方法:{}\n --描述:{}\n --位置:{}\n --参数:{}\n --返回:{}\n --耗时:{} ms"; + // private static final String MSG = "\n --请求--\n --方法:{}\n --描述:{}\n --位置:{}\n --参数:{}\n --返回:{}\n --耗时:{} ms"; + private static final String MSG = "\n --request--\n --method:{}\n --description:{}\n --position:{}\n --parameter:{}\n --result:{}\n --time consuming:{} ms"; /** * 服务响应超过2秒打印警告日志 */ diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/InvokeLogAspect.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/InvokeLogAspect.java index df8e2d63..de13766d 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/InvokeLogAspect.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/log/InvokeLogAspect.java @@ -39,9 +39,8 @@ public class InvokeLogAspect extends AbstractPrintLog { /* TODO 日志处理 @Autowired - private LogService logService;*/ - - + private LogService logService; + */ @Override protected void handleLog(ProceedingJoinPoint joinPoint, Object[] args, Object returnObj, long costTime) { Method method = ((MethodSignature) joinPoint.getSignature()).getMethod(); @@ -65,12 +64,9 @@ public class InvokeLogAspect extends AbstractPrintLog { public void excudePointcut() { } - @Around("excudePointcut()") @Override public Object execute(ProceedingJoinPoint joinPoint) throws Throwable { return super.execute(joinPoint); } - - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/BaseResponse.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/BaseResponse.java index 07f13390..f8181715 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/BaseResponse.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/BaseResponse.java @@ -78,7 +78,6 @@ public class BaseResponse implements Serializable { this.data = data; } - @Override public String toString() { return new ToStringBuilder(this) @@ -88,7 +87,6 @@ public class BaseResponse implements Serializable { .toString(); } - public String toJsonString() { return "{" + "\"msg\":\"" + msg + "\"," + @@ -96,5 +94,4 @@ public class BaseResponse implements Serializable { "\"data\":\"" + data + "\"" + '}'; } - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/ResponseCode.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/ResponseCode.java index 4422d25b..c82d4212 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/ResponseCode.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/response/ResponseCode.java @@ -17,8 +17,18 @@ import java.util.HashMap; public enum ResponseCode implements StatusCode { - API_SUCCESS("10000", "接口调用成功"), - API_ERROR_1("10001", "设备IMEI码不存在"), + // API_SUCCESS("10000", "接口调用成功"), + // API_ERROR_1("10001", "设备IMEI码不存在"), + // API_ERROR_2("10002", ""), + // API_ERROR_3("10003", ""), + // API_ERROR_4("10004", ""), + // API_ERROR_5("10005", ""), + // API_ERROR_6("10006", ""), + // API_ERROR_7("10007", ""), + // API_ERROR_8("10008", ""), + + API_SUCCESS("10000", "Interface call succeeded"), + API_ERROR_1("10001", "Device IMEI code does not exist"), API_ERROR_2("10002", ""), API_ERROR_3("10003", ""), API_ERROR_4("10004", ""), @@ -30,102 +40,131 @@ public enum ResponseCode implements StatusCode { /** * 系统错误 */ - SYSTEM_ERROR("20000", "系统开了点小差,请稍后再试"), + // SYSTEM_ERROR("20000", "系统开了点小差,请稍后再试"), + SYSTEM_ERROR("20000", "Something went wrong with the system, please try again later"), /** * 参数错误 */ - PARAM_FAIL("30000", "参数错误"), - + // PARAM_FAIL("30000", "参数错误"), + PARAM_FAIL("30000", "Parameter error"), /** * 不符合业务处理,抛出的异常代码 * 所有业务错误码,以4开头添加 */ - BIZ_FAIL("40000", "业务异常"), + // BIZ_FAIL("40000", "业务异常"), + BIZ_FAIL("40000", "Abnormal business"), /** * 用户不存在 */ - USER_NOT_EXIST("40001", "用户不存在"), + // USER_NOT_EXIST("40001", "用户不存在"), + USER_NOT_EXIST("40001", "User does not exist"), - NO_STREAM("40002", "无流量记录"), + // NO_STREAM("40002", "无流量记录"), + NO_STREAM("40002", "No flow record"), - REPLICATED("40003", "重复数据"), + // REPLICATED("40003", "重复数据"), + REPLICATED("40003", "Duplicate data"), /** * 登陆成功 */ - LOGIN_SUCCESS("50000", "登陆成功"), + // LOGIN_SUCCESS("50000", "登陆成功"), + LOGIN_SUCCESS("50000", "Login successfully"), /** * 登陆失败 */ - LOGIN_FAIL("50001", "登陆失败,用户名或者密码错误"), + // LOGIN_FAIL("50001", "登陆失败,用户名或者密码错误"), + LOGIN_FAIL("50001", "Login failed, wrong username or password"), - - NO_PERMISSION("50002", "用户无权限"), + // NO_PERMISSION("50002", "用户无权限"), + NO_PERMISSION("50002", "User has no permissions"), /** * 退出成功 */ - LOGOUT_SUCCESS("50003", "退出成功"), + // LOGOUT_SUCCESS("50003", "退出成功"), + LOGOUT_SUCCESS("50003", "Logout successfully"), /** * 没有Token */ - NO_TOKEN("50004", "没有Token"), + // NO_TOKEN("50004", "没有Token"), + NO_TOKEN("50004", "No Token"), /** * 没有Token */ - TOKEN_ERROR("50005", "token验证失败"), + // TOKEN_ERROR("50005", "token验证失败"), + TOKEN_ERROR("50005", "Token verification failed"), /** * 密码过期 */ - LOGIN_OVER_DUE("50006", "密码过期,请修改密码"), - LOGIN_ABOUT_OVER_DUE("50007", "密码即将过期"), + // LOGIN_OVER_DUE("50006", "密码过期,请修改密码"), + // LOGIN_ABOUT_OVER_DUE("50007", "密码即将过期"), + LOGIN_OVER_DUE("50006", "Password expired, please change the password"), + LOGIN_ABOUT_OVER_DUE("50007", "Password is about to expire"), - SSO_LOGIN_FAIL("50008", "单点登录失败"), + // SSO_LOGIN_FAIL("50008", "单点登录失败"), + SSO_LOGIN_FAIL("50008", "Single sign-on failed"), - - NO_KEY("50009", "无法获取登录秘钥"), + // NO_KEY("50009", "无法获取登录秘钥"), + NO_KEY("50009", "Can't get login key"), /** * referer风险提示 */ - REFERER_ERROR("50010", "疑似referer风险,禁止访问"), + // REFERER_ERROR("50010", "疑似referer风险,禁止访问"), + REFERER_ERROR("50010", "Suspected referer risk, denied access"), /** * 执行成功 */ - SUCCESS("0", "操作成功"), + // SUCCESS("0", "操作成功"), + SUCCESS("0", "Successful operation"), /** * 执行失败 */ - Fail("1", "操作失败"), + // Fail("1", "操作失败"), + Fail("1", "Operation failed"), - BOOTING("2", "启动中"), + // BOOTING("2", "启动中"), + BOOTING("2", "Starting"), /** * umaa */ - UMAA_SUCCESS("0000", "成功"), - UMAA_SYSTEM_ERROR("0001", "系统出现错误请联系管理员"), - UMAA_PARAMS_ERROR("0002", "输入参数有错误"), - UMAA_XML_ERROR("0003", "输入数据有误,不能解析的xml"), - UMAA_EVENTID_ERROR("0004", "输入的EventId有误"), - UMAA_INFO_LACK_ERROR("0005", "必填字段缺失"), - UMAA_NO_DATA_PORCESS_ERROR("0006", "没有需要处理的数据"), - UMAA_NO_TARTET_ERROR("0007", "找不到目标系统"), - UMAA_REPEAT_ERROR("0008", "状态已回写,无需再次处理"), - UMAA_NO_IMP_ERROR("0009", "该交易码对应的逻辑未实现"), - UMAA_TRADE_CODE_ERROR("0010", "请确认交易码是否正确,该交易请求不需要报文体"), - UMAA_UNKOWN_ERROR("0011", "远程校验tokenId失败"); + // UMAA_SUCCESS("0000", "成功"), + // UMAA_SYSTEM_ERROR("0001", "系统出现错误请联系管理员"), + // UMAA_PARAMS_ERROR("0002", "输入参数有错误"), + // UMAA_XML_ERROR("0003", "输入数据有误,不能解析的xml"), + // UMAA_EVENTID_ERROR("0004", "输入的EventId有误"), + // UMAA_INFO_LACK_ERROR("0005", "必填字段缺失"), + // UMAA_NO_DATA_PORCESS_ERROR("0006", "没有需要处理的数据"), + // UMAA_NO_TARTET_ERROR("0007", "找不到目标系统"), + // UMAA_REPEAT_ERROR("0008", "状态已回写,无需再次处理"), + // UMAA_NO_IMP_ERROR("0009", "该交易码对应的逻辑未实现"), + // UMAA_TRADE_CODE_ERROR("0010", "请确认交易码是否正确,该交易请求不需要报文体"), + // UMAA_UNKOWN_ERROR("0011", "远程校验tokenId失败"); + UMAA_SUCCESS("0000", "success"), + UMAA_SYSTEM_ERROR("0001", "System error, please contact the administrator"), + UMAA_PARAMS_ERROR("0002", "The input parameter is wrong"), + UMAA_XML_ERROR("0003", "The input data is wrong, cannot be parsed xml"), + UMAA_EVENTID_ERROR("0004", "The entered EventIdz field is wrong"), + UMAA_INFO_LACK_ERROR("0005", "Required field is missing"), + UMAA_NO_DATA_PORCESS_ERROR("0006", "No data to process"), + UMAA_NO_TARTET_ERROR("0007", "No target system found"), + UMAA_REPEAT_ERROR("0008", "Status has been written back, no need to process again"), + UMAA_NO_IMP_ERROR("0009", "The logic corresponding to the transaction code is not implemented"), + UMAA_TRADE_CODE_ERROR("0010", "Please confirm whether the transaction code is correct, the transaction request does not require a message body"), + UMAA_UNKOWN_ERROR("0011", "Failed to verify tokenId remotely"); public static HashMap codeMap; @@ -143,7 +182,6 @@ public enum ResponseCode implements StatusCode { put(UMAA_NO_IMP_ERROR.getCode(), UMAA_NO_IMP_ERROR); put(UMAA_TRADE_CODE_ERROR.getCode(), UMAA_TRADE_CODE_ERROR); put(UMAA_UNKOWN_ERROR.getCode(), UMAA_UNKOWN_ERROR); - }}; } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/CacheUtil.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/CacheUtil.java index 1e05bf9d..db0be4b7 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/CacheUtil.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/CacheUtil.java @@ -69,6 +69,4 @@ public class CacheUtil { return null; } } - - } \ No newline at end of file diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/FileDataChangeUtil.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/FileDataChangeUtil.java index 5175bac8..0381ba58 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/FileDataChangeUtil.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/FileDataChangeUtil.java @@ -25,7 +25,8 @@ public class FileDataChangeUtil { }catch (Exception e){ e.printStackTrace(); } - return "解析文件失败!!!"; + // return "解析文件失败!!!"; + return "Failed to parse file!!!"; } //从数据流中读取文本内容 @@ -42,7 +43,8 @@ public class FileDataChangeUtil { }catch (Exception e){ e.printStackTrace(); } - return "解析文件失败!!!"; + // return "解析文件失败!!!"; + return "Failed to parse file!!!"; } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/HttpClientUtil.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/HttpClientUtil.java index 79dba03c..546020f1 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/HttpClientUtil.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/HttpClientUtil.java @@ -161,7 +161,8 @@ public class HttpClientUtil { //.setSSLHostnameVerifier(hv) .build(); } catch (Exception e) { - log.error("初始化http client异常", e); + // log.error("初始化http client异常", e); + log.error("An exception occurred while initializing http client", e); e.printStackTrace(); } } @@ -363,7 +364,8 @@ public class HttpClientUtil { out = new ByteArrayOutputStream(); IOUtils.copy(in, out); - throw new DownloadFileException(out.toString(), "下载文件失败"); + // throw new DownloadFileException(out.toString(), "下载文件失败"); + throw new DownloadFileException(out.toString(), "File download failed"); } File file = new File(localFilePath); @@ -400,7 +402,8 @@ public class HttpClientUtil { return result; } } catch (IOException e) { - log.error(String.format("上传文件 %s 到 %s 异常", filePath, url)); + // log.error(String.format("上传文件 %s 到 %s 异常", filePath, url)); + log.error(String.format("An exception occurred while uploading files %s to %s", filePath, url)); e.printStackTrace(); } @@ -437,7 +440,8 @@ public class HttpClientUtil { return result; } } catch (Exception e) { - log.error(String.format("发送文件 %s 到 %s 异常", filePath, url)); + // log.error(String.format("发送文件 %s 到 %s 异常", filePath, url)); + log.error(String.format("An exception occurred while sending files %s to %s", filePath, url)); e.printStackTrace(); } @@ -488,7 +492,5 @@ public class HttpClientUtil { } return false; } - } - } \ No newline at end of file diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/OSinfo.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/OSinfo.java index e03d3150..a7d2725c 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/OSinfo.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/OSinfo.java @@ -150,5 +150,4 @@ public class OSinfo { System.out.println("isMacOS:"+OSinfo.isMacOS()); System.out.println("isMacOSX:"+OSinfo.isMacOSX()); } - } diff --git a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/Utils.java b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/Utils.java index 324e6ddf..f4f997b5 100644 --- a/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/Utils.java +++ b/distributed-deploy/bcp-install-common/src/main/java/com/cgb/bcpinstall/common/util/Utils.java @@ -96,7 +96,6 @@ public final class Utils { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } - } if (null != chaincodeMetaInf) { @@ -122,9 +121,7 @@ public final class Utils { IOUtils.closeQuietly(fileInputStream); archiveOutputStream.closeArchiveEntry(); } - } - } } finally { IOUtils.closeQuietly(archiveOutputStream); @@ -274,7 +271,6 @@ public final class Utils { } return encodeHexString(bytes); - } /** @@ -282,5 +278,4 @@ public final class Utils { */ private Utils() { } - } diff --git a/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/MainApplication.java b/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/MainApplication.java index 38563937..61f81109 100644 --- a/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/MainApplication.java +++ b/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/MainApplication.java @@ -55,17 +55,20 @@ public class MainApplication { public static void main(String[] args) { ApplicationContext app = SpringApplication.run(MainApplication.class, args); SpringUtil.setApplicationContext(app); - log.info("bcp-install 安装服务已启动..."); + // log.info("bcp-install 安装服务已启动..."); + log.info("bcp-install installation service has started..."); GlobalConfig config = (GlobalConfig) SpringUtil.getBean("globalConfig"); if (config.getMaster() == 1) { - log.info("本结点是主节点"); + // log.info("本结点是主节点"); + log.info("This node is the master node"); InitializeBiz initializeBiz = (InitializeBiz) SpringUtil.getBean("initializeBiz"); if (initializeBiz.needInit()) { BaseResponse response = initializeBiz.initialize(); if (!response.getCode().equals(ResponseCode.SUCCESS)) { log.error(response.getMsg()); } else { - log.info("初始化完成"); + // log.info("初始化完成"); + log.info("Initialization completed"); } SpringApplication.exit(app, () -> 0); return; @@ -94,7 +97,8 @@ public class MainApplication { @Override public void run(String... args) { - log.info("bcp-app-install 完成资源初始化"); + // log.info("bcp-app-install 完成资源初始化"); + log.info("bcp-app-install completed the resource initialization"); initToolsFilePath(); } @@ -123,9 +127,13 @@ public class MainApplication { CacheUtil.putConfigtxgenFilePath(toolsPath + "linux" + "/" + ToolsConstant.CONFIGTXGEN); CacheUtil.putConfigtxlatorFilePath(toolsPath + "linux" + "/" + ToolsConstant.CONFIGTXLATOR); } - log.info("*** " + ToolsConstant.CRYPTOGEN + "工具本地路径为:" + CacheUtil.getCryptogenFilePath()); - log.info("*** " + ToolsConstant.CONFIGTXGEN + "工具本地路径为:" + CacheUtil.getConfigtxgenFilePath()); - log.info("*** " + ToolsConstant.CONFIGTXLATOR + "工具本地路径为:" + CacheUtil.getConfigtxlatorFilePath()); + // log.info("*** " + ToolsConstant.CRYPTOGEN + "工具本地路径为:" + CacheUtil.getCryptogenFilePath()); + // log.info("*** " + ToolsConstant.CONFIGTXGEN + "工具本地路径为:" + CacheUtil.getConfigtxgenFilePath()); + // log.info("*** " + ToolsConstant.CONFIGTXLATOR + "工具本地路径为:" + CacheUtil.getConfigtxlatorFilePath()); + + log.info("*** " + ToolsConstant.CRYPTOGEN + "The local path of the tool is:" + CacheUtil.getCryptogenFilePath()); + log.info("*** " + ToolsConstant.CONFIGTXGEN + "The local path of the tool is:" + CacheUtil.getConfigtxgenFilePath()); + log.info("*** " + ToolsConstant.CONFIGTXLATOR + "The local path of the tool is:" + CacheUtil.getConfigtxlatorFilePath()); } } } diff --git a/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/interceptor/UserInterceptor.java b/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/interceptor/UserInterceptor.java index f693f37f..a2a85c97 100644 --- a/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/interceptor/UserInterceptor.java +++ b/distributed-deploy/bcp-install-main/src/main/java/com/cgb/bcpinstall/main/interceptor/UserInterceptor.java @@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.util.List; - /** * @program: UserInterceptor * @description: @@ -55,8 +54,6 @@ public class UserInterceptor implements HandlerInterceptor { return menus.parallelStream().anyMatch(menu -> menu.equals(u) ); - - } @Override @@ -102,7 +99,6 @@ public class UserInterceptor implements HandlerInterceptor { @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { RequestContextHandler.remove(); - } private void resultInfo(HttpServletResponse response, ResponseCode code) throws Exception { @@ -114,5 +110,4 @@ public class UserInterceptor implements HandlerInterceptor { writer.flush(); writer.close(); } - }