hyperledger fabric2.4测试网络添加组织数量

!!!修改内容比较繁琐,预期未来提供模板修改

修改初始配置文件,初始添加3个组织

organizations文件夹

/cryptogen文件夹下创建文件crypto-config-org3.yaml,内容如下:

PeerOrgs:# ---------------------------------------------------------------------------# Org3# ---------------------------------------------------------------------------- Name: Org3Domain: org3.example.comEnableNodeOUs: trueTemplate:Count: 1SANS:- localhostUsers:Count: 1

在/fabric-ca/org3文件夹中创建fabric-ca-server-config.yaml,内容如下:

version: 1.2.0
port: 11054
debug: false
crlsizelimit: 512000
tls:enabled: truecertfile:keyfile:clientauth:type: noclientcertcertfiles:
ca:name: Org3CAkeyfile:certfile:chainfile:
crl:expiry: 24h
registry:maxenrollments: -1identities:- name: adminpass: adminpwtype: clientaffiliation: ""attrs:hf.Registrar.Roles: "*"hf.Registrar.DelegateRoles: "*"hf.Revoker: truehf.IntermediateCA: truehf.GenCRL: truehf.Registrar.Attributes: "*"hf.AffiliationMgr: true
db:type: sqlite3datasource: fabric-ca-server.dbtls:enabled: falsecertfiles:client:certfile:keyfile:
ldap:enabled: falseurl: ldap://<adminDN>:<adminPassword>@<host>:<port>/<base>tls:certfiles:client:certfile:keyfile:attribute:names: ['uid','member']converters:- name:value:maps:groups:- name:value:
affiliations:org1:- department1- department2org2:- department1
signing:default:usage:- digital signatureexpiry: 8760hprofiles:ca:usage:- cert sign- crl signexpiry: 43800hcaconstraint:isca: truemaxpathlen: 0tls:usage:- signing- key encipherment- server auth- client auth- key agreementexpiry: 8760h
csr:cn: ca.org3.example.comnames:- C: USST: "North Carolina"L: "Raleigh"O: org3.example.comOU:hosts:- localhost- org3.example.comca:expiry: 131400hpathlength: 1
bccsp:default: SWsw:hash: SHA2security: 256filekeystore:keystore: msp/keystore
cacount:
cafiles:
intermediate:parentserver:url:caname:enrollment:hosts:profile:label:tls:certfiles:client:certfile:keyfile:

修改/fabric-ca中的registerEnroll.sh,添加如下内容:

function createOrg3() {infoln "Enrolling the CA admin"mkdir -p organizations/peerOrganizations/org3.example.com/export FABRIC_CA_CLIENT_HOME=${PWD}/organizations/peerOrganizations/org3.example.com/set -xfabric-ca-client enroll -u https://admin:adminpw@localhost:11054 --caname ca-org3 --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullecho 'NodeOUs:Enable: trueClientOUIdentifier:Certificate: cacerts/localhost-11054-ca-org3.pemOrganizationalUnitIdentifier: clientPeerOUIdentifier:Certificate: cacerts/localhost-11054-ca-org3.pemOrganizationalUnitIdentifier: peerAdminOUIdentifier:Certificate: cacerts/localhost-11054-ca-org3.pemOrganizationalUnitIdentifier: adminOrdererOUIdentifier:Certificate: cacerts/localhost-11054-ca-org3.pemOrganizationalUnitIdentifier: orderer' > "${PWD}/organizations/peerOrganizations/org3.example.com/msp/config.yaml"# Since the CA serves as both the organization CA and TLS CA, copy the org's root cert that was generated by CA startup into the org level ca and tlsca directories# Copy org3's CA cert to org3's /msp/tlscacerts directory (for use in the channel MSP definition)mkdir -p "${PWD}/organizations/peerOrganizations/org3.example.com/msp/tlscacerts"cp "${PWD}/organizations/fabric-ca/org3/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org3.example.com/msp/tlscacerts/ca.crt"# Copy org3's CA cert to org3's /tlsca directory (for use by clients)mkdir -p "${PWD}/organizations/peerOrganizations/org3.example.com/tlsca"cp "${PWD}/organizations/fabric-ca/org3/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem"# Copy org3's CA cert to org3's /ca directory (for use by clients)mkdir -p "${PWD}/organizations/peerOrganizations/org3.example.com/ca"cp "${PWD}/organizations/fabric-ca/org3/ca-cert.pem" "${PWD}/organizations/peerOrganizations/org3.example.com/ca/ca.org3.example.com-cert.pem"infoln "Registering peer0"set -xfabric-ca-client register --caname ca-org3 --id.name peer0 --id.secret peer0pw --id.type peer --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullinfoln "Registering user"set -xfabric-ca-client register --caname ca-org3 --id.name user1 --id.secret user1pw --id.type client --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullinfoln "Registering the org admin"set -xfabric-ca-client register --caname ca-org3 --id.name org3admin --id.secret org3adminpw --id.type admin --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullinfoln "Generating the peer0 msp"set -xfabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-org3 -M "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullcp "${PWD}/organizations/peerOrganizations/org3.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/msp/config.yaml"infoln "Generating the peer0-tls certificates, use --csr.hosts to specify Subject Alternative Names"set -xfabric-ca-client enroll -u https://peer0:peer0pw@localhost:11054 --caname ca-org3 -M "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls" --enrollment.profile tls --csr.hosts peer0.org3.example.com --csr.hosts localhost --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/null# Copy the tls CA cert, server cert, server keystore to well known file names in the peer's tls directory that are referenced by peer startup configcp "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/tlscacerts/"* "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt"cp "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/signcerts/"* "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.crt"cp "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/keystore/"* "${PWD}/organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/server.key"infoln "Generating the user msp"set -xfabric-ca-client enroll -u https://user1:user1pw@localhost:11054 --caname ca-org3 -M "${PWD}/organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullcp "${PWD}/organizations/peerOrganizations/org3.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org3.example.com/users/User1@org3.example.com/msp/config.yaml"infoln "Generating the org admin msp"set -xfabric-ca-client enroll -u https://org3admin:org3adminpw@localhost:11054 --caname ca-org3 -M "${PWD}/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp" --tls.certfiles "${PWD}/organizations/fabric-ca/org3/ca-cert.pem"{ set +x; } 2>/dev/nullcp "${PWD}/organizations/peerOrganizations/org3.example.com/msp/config.yaml" "${PWD}/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/msp/config.yaml"
}

ccp-generate.sh中添加如下代码

ORG=3
P0PORT=11051
CAPORT=11054
PEERPEM=organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem
CAPEM=organizations/peerOrganizations/org3.example.com/ca/ca.org3.example.com-cert.pemecho "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org3.example.com/connection-org3.json
echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org3.example.com/connection-org3.yaml

test-network文件夹

在setOrgEnv.sh中添加如下内容

elif [[ ${ORG,,} == "org3" ]]; thenCORE_PEER_LOCALMSPID=Org3MSPCORE_PEER_MSPCONFIGPATH=${DIR}/test-network/organizations/peerOrganizations/org3.example.com/users/Admin@org3.example.com/mspCORE_PEER_ADDRESS=localhost:11051CORE_PEER_TLS_ROOTCERT_FILE=${DIR}/test-network/organizations/peerOrganizations/org3.example.com/tlsca/tlsca.org3.example.com-cert.pem

compose文件夹

compose-ca.yaml添加如下内容:

ca_org3:image: hyperledger/fabric-ca:latestlabels:service: hyperledger-fabricenvironment:- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server- FABRIC_CA_SERVER_CA_NAME=ca-org3- FABRIC_CA_SERVER_TLS_ENABLED=true- FABRIC_CA_SERVER_PORT=11054- FABRIC_CA_SERVER_OPERATIONS_LISTENADDRESS=0.0.0.0:19054ports:- "11054:11054"- "19054:19054"command: sh -c 'fabric-ca-server start -b admin:adminpw -d'volumes:- ../organizations/fabric-ca/org3:/etc/hyperledger/fabric-ca-servercontainer_name: ca_org3networks:- test

compose-couch.yaml添加如下内容

couchdb2:container_name: couchdb2image: couchdb:3.2.2labels:service: hyperledger-fabric# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password# for CouchDB.  This will prevent CouchDB from operating in an "Admin Party" mode.environment:- COUCHDB_USER=admin- COUCHDB_PASSWORD=adminpw# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,# for example map it to utilize Fauxton User Interface in dev environments.ports:- "9984:5984"networks:- testpeer0.org3.example.com:environment:- CORE_LEDGER_STATE_STATEDATABASE=CouchDB- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb4:5984# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD# provide the credentials for ledger to connect to CouchDB.  The username and password must# match the username and password set for the associated CouchDB.- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=adminpwdepends_on:- couchdb2

compose-test-net.yaml修改以及添加如下内容

volumes:orderer.example.com:peer0.org1.example.com:peer0.org2.example.com:peer0.org3.example.com:peer0.org3.example.com:container_name: peer0.org3.example.comimage: hyperledger/fabric-peer:latestlabels:service: hyperledger-fabricenvironment:- FABRIC_CFG_PATH=/etc/hyperledger/peercfg- FABRIC_LOGGING_SPEC=INFO#- FABRIC_LOGGING_SPEC=DEBUG- CORE_PEER_TLS_ENABLED=true- CORE_PEER_PROFILE_ENABLED=false- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt# Peer specific variables- CORE_PEER_ID=peer0.org3.example.com- CORE_PEER_ADDRESS=peer0.org3.example.com:11051- CORE_PEER_LISTENADDRESS=0.0.0.0:11051- CORE_PEER_CHAINCODEADDRESS=peer0.org3.example.com:11052- CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:11052- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org3.example.com:11051- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org3.example.com:11051- CORE_PEER_LOCALMSPID=Org3MSP- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/fabric/msp      - CORE_OPERATIONS_LISTENADDRESS=peer0.org3.example.com:9446- CORE_METRICS_PROVIDER=prometheus- CHAINCODE_AS_A_SERVICE_BUILDER_CONFIG={"peername":"peer0org3"}- CORE_CHAINCODE_EXECUTETIMEOUT=300svolumes:- ../organizations/peerOrganizations/org3.example.com/peers/peer0.org3.example.com:/etc/hyperledger/fabric        - peer0.org3.example.com:/var/hyperledger/productionworking_dir: /rootcommand: peer node startports:- 11051:11051- 9446:9446networks:- test

测试

启动测试网络

sudo ./network.sh up

创建通道

sudo ./network.sh createChannel

安装链码

sudo chmod -R 777 ../test-network
./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go

之后按照我这篇博客:小白也能读懂的Fabric测试网络运行以及链码部署进行测试.
可以看到完整结果如下:
在这里插入图片描述

链码部署文件修改

/script 中的deployCC.sh修改的地方比较零散,用下面的内容进行覆盖:

#!/bin/bashsource scripts/utils.shCHANNEL_NAME=${1:-"mychannel"}
CC_NAME=${2}
CC_SRC_PATH=${3}
CC_SRC_LANGUAGE=${4}
CC_VERSION=${5:-"1.0"}
CC_SEQUENCE=${6:-"1"}
CC_INIT_FCN=${7:-"NA"}
CC_END_POLICY=${8:-"NA"}
CC_COLL_CONFIG=${9:-"NA"}
DELAY=${10:-"3"}
MAX_RETRY=${11:-"5"}
VERBOSE=${12:-"false"}println "executing with the following"
println "- CHANNEL_NAME: ${C_GREEN}${CHANNEL_NAME}${C_RESET}"
println "- CC_NAME: ${C_GREEN}${CC_NAME}${C_RESET}"
println "- CC_SRC_PATH: ${C_GREEN}${CC_SRC_PATH}${C_RESET}"
println "- CC_SRC_LANGUAGE: ${C_GREEN}${CC_SRC_LANGUAGE}${C_RESET}"
println "- CC_VERSION: ${C_GREEN}${CC_VERSION}${C_RESET}"
println "- CC_SEQUENCE: ${C_GREEN}${CC_SEQUENCE}${C_RESET}"
println "- CC_END_POLICY: ${C_GREEN}${CC_END_POLICY}${C_RESET}"
println "- CC_COLL_CONFIG: ${C_GREEN}${CC_COLL_CONFIG}${C_RESET}"
println "- CC_INIT_FCN: ${C_GREEN}${CC_INIT_FCN}${C_RESET}"
println "- DELAY: ${C_GREEN}${DELAY}${C_RESET}"
println "- MAX_RETRY: ${C_GREEN}${MAX_RETRY}${C_RESET}"
println "- VERBOSE: ${C_GREEN}${VERBOSE}${C_RESET}"FABRIC_CFG_PATH=$PWD/../config/#User has not provided a name
if [ -z "$CC_NAME" ] || [ "$CC_NAME" = "NA" ]; thenfatalln "No chaincode name was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"# User has not provided a path
elif [ -z "$CC_SRC_PATH" ] || [ "$CC_SRC_PATH" = "NA" ]; thenfatalln "No chaincode path was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"# User has not provided a language
elif [ -z "$CC_SRC_LANGUAGE" ] || [ "$CC_SRC_LANGUAGE" = "NA" ]; thenfatalln "No chaincode language was provided. Valid call example: ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go"## Make sure that the path to the chaincode exists
elif [ ! -d "$CC_SRC_PATH" ] && [ ! -f "$CC_SRC_PATH" ]; thenfatalln "Path to chaincode does not exist. Please provide different path."
fiCC_SRC_LANGUAGE=$(echo "$CC_SRC_LANGUAGE" | tr [:upper:] [:lower:])# do some language specific preparation to the chaincode before packaging
if [ "$CC_SRC_LANGUAGE" = "go" ]; thenCC_RUNTIME_LANGUAGE=golanginfoln "Vendoring Go dependencies at $CC_SRC_PATH"pushd $CC_SRC_PATHGO111MODULE=on go mod vendorpopdsuccessln "Finished vendoring Go dependencies"elif [ "$CC_SRC_LANGUAGE" = "java" ]; thenCC_RUNTIME_LANGUAGE=javarm -rf $CC_SRC_PATH/build/install/infoln "Compiling Java code..."pushd $CC_SRC_PATH./gradlew installDistpopdsuccessln "Finished compiling Java code"CC_SRC_PATH=$CC_SRC_PATH/build/install/$CC_NAMEelif [ "$CC_SRC_LANGUAGE" = "javascript" ]; thenCC_RUNTIME_LANGUAGE=nodeelif [ "$CC_SRC_LANGUAGE" = "typescript" ]; thenCC_RUNTIME_LANGUAGE=nodeinfoln "Compiling TypeScript code into JavaScript..."pushd $CC_SRC_PATHnpm installnpm run buildpopdsuccessln "Finished compiling TypeScript code into JavaScript"elsefatalln "The chaincode language ${CC_SRC_LANGUAGE} is not supported by this script. Supported chaincode languages are: go, java, javascript, and typescript"exit 1
fiINIT_REQUIRED="--init-required"
# check if the init fcn should be called
if [ "$CC_INIT_FCN" = "NA" ]; thenINIT_REQUIRED=""
fiif [ "$CC_END_POLICY" = "NA" ]; thenCC_END_POLICY=""
elseCC_END_POLICY="--signature-policy $CC_END_POLICY"
fiif [ "$CC_COLL_CONFIG" = "NA" ]; thenCC_COLL_CONFIG=""
elseCC_COLL_CONFIG="--collections-config $CC_COLL_CONFIG"
fi# import utils
. scripts/envVar.sh
. scripts/ccutils.shpackageChaincode() {set -xpeer lifecycle chaincode package ${CC_NAME}.tar.gz --path ${CC_SRC_PATH} --lang ${CC_RUNTIME_LANGUAGE} --label ${CC_NAME}_${CC_VERSION} >&log.txtres=$?PACKAGE_ID=$(peer lifecycle chaincode calculatepackageid ${CC_NAME}.tar.gz){ set +x; } 2>/dev/nullcat log.txtverifyResult $res "Chaincode packaging has failed"successln "Chaincode is packaged"
}function checkPrereqs() {jq --version > /dev/null 2>&1if [[ $? -ne 0 ]]; thenerrorln "jq command not found..."errorlnerrorln "Follow the instructions in the Fabric docs to install the prereqs"errorln "https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html"exit 1fi
}#check for prerequisites
checkPrereqs## package the chaincode
packageChaincode## Install chaincode on peer0.org1 and peer0.org2
infoln "Installing chaincode on peer0.org1..."
installChaincode 1
infoln "Install chaincode on peer0.org2..."
installChaincode 2
infoln "Install chaincode on peer0.org3..."
installChaincode 3## query whether the chaincode is installed
queryInstalled 1## approve the definition for org1
approveForMyOrg 1## check whether the chaincode definition is ready to be committed
## expect org1 to have approved and org2 not to
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org2MSP\": false" "\"Org3MSP\": false"
checkCommitReadiness 2 "\"Org1MSP\": true" "\"Org2MSP\": false" "\"Org3MSP\": false"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org2MSP\": false" "\"Org3MSP\": false"## now approve also for org2
approveForMyOrg 2## check whether the chaincode definition is ready to be committed
## expect them both to have approved
checkCommitReadiness 1 "\"Org1MSP\": true" "\"Org2MSP\": true" "\"Org3MSP\": false"
checkCommitReadiness 2 "\"Org1MSP\": true" "\"Org2MSP\": true" "\"Org3MSP\": false"
checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org2MSP\": true" "\"Org3MSP\": false"## now approve also for org2
approveForMyOrg 3checkCommitReadiness 3 "\"Org1MSP\": true" "\"Org2MSP\": true" "\"Org3MSP\": false"## now that we know for sure both orgs have approved, commit the definition
commitChaincodeDefinition 1 2 3## query on both orgs to see that the definition committed successfully
queryCommitted 1
queryCommitted 2
queryCommitted 3## Invoke the chaincode - this does require that the chaincode have the 'initLedger'
## method defined
if [ "$CC_INIT_FCN" = "NA" ]; theninfoln "Chaincode initialization is not required"
elsechaincodeInvokeInit 1 2 3
fi
exit 0

运行

修改上述文件之后再重新启动网络,查看输出结果,可以看到3个组织都同意了.
在这里插入图片描述

初始化4个节点,添加addorg5

根据之前的内容定义第四个组织

此处不在赘述

添加org5

之后的博客再写.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/147878.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

酷柚易汛ERP - 序列号盘点操作指南

1、应用场景 将系统中开启序列号的商品数量与与实际存放的数量进行对比。 2、主要操作 2.1 录入序列号 打开【盘点】-【序列号盘点】&#xff0c;新增序列号盘点单&#xff0c;点击【SN】按钮&#xff0c;在弹框中输入序列号。 支持扫描枪录入序列号支持复制粘贴序列号录入…

Java(二)(String的常见方法,ArrayList的常见方法)

String 创建string对象 package Helloworld;public class dome1 {public static void main(String[] args) {// 1.直接双引号得到字符串对象,封装字符串对象String name "lihao";System.out.println(name);// 2. new String 创建字符串对象,并调用构造器初始化字符…

力扣 字母异位词分组 哈表 集合

&#x1f468;‍&#x1f3eb; 力扣 字母异位词分组 ⭐ 思路 由于互为字母异位词的两个字符串包含的字母相同&#xff0c;因此对两个字符串分别进行排序之后得到的字符串一定是相同的&#xff0c;故可以将排序之后的字符串作为哈希表的键。 &#x1f351; AC code class Solut…

解析Spring Boot中的CommandLineRunner和ApplicationRunner:用法、区别和适用场景详解

在Spring Boot应用程序中&#xff0c;CommandLineRunner和ApplicationRunner是两个重要的接口&#xff0c;它们允许我们在应用程序启动后执行一些初始化任务。本文将介绍CommandLineRunner和ApplicationRunner的区别&#xff0c;并提供代码示例和使用场景&#xff0c;让我们更好…

公共字段自动填充-@TableField的fill实现(2)

TheadLocal 客户端发送的每次http请求&#xff0c;在服务端都会分配新的线程。因此登录检查过滤器、controller、元数据对象处理器属于一个线程。 TheadLocal是线程的局部变量&#xff1a; TheadLocal常用方法&#xff1a; 如何在元数据对象处理器中获取当前登录用户的id&…

Spring Boot 项目部署方案!打包 + Shell 脚本部署详解

文章目录 概要一 、profiles指定不同环境的配置二、maven-assembly-plugin打发布压缩包三、 分享shenniu_publish.sh程序启动工具四、linux上使用shenniu_publish.sh启动程序 概要 本篇和大家分享的是springboot打包并结合shell脚本命令部署&#xff0c;重点在分享一个shell程…

【MATLAB源码-第83期】基于matlab的MIMO中V-BALST结构ZF和MMSE检测算法性能误码率对比。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 在多输入多输出&#xff08;MIMO&#xff09;通信系统中&#xff0c;V-BLAST&#xff08;垂直波束形成层间空间时间编码技术&#xff09;是一种流行的技术&#xff0c;用于提高无线通信的数据传输速率和容量。它通过在不同的…

如何将 Docsify 项目部署到 CentOS 系统的 Nginx 中

文章目录 第一步&#xff1a;准备 CentOS 服务器第二步&#xff1a;安装 Node.js 和 Docsify第三步&#xff1a;初始化 Docsify 项目第四步&#xff1a;本地预览 Docsify 项目第五步&#xff1a;配置 Nginx 服务器第六步&#xff1a;重启 Nginx 服务器拓展&#xff1a;使用 HTT…

k8s-部署Redis-cluster(TLS)

helm pull bitnami/redis-cluster v8.3.8拉取源码生成证书 git clone https://github.com/redis/redis.git #文档 https://redis.io/docs/management/security/encryption/#getting-started生成你的TLS证书用官网的工具生成 1 Run ./utils/gen-test-certs.sh 生成根CA和服务…

Python 如何实现备忘录设计模式?什么是备忘录设计模式?Python 备忘录设计模式示例代码

什么是备忘录&#xff08;Memento&#xff09;设计模式&#xff1f; 备忘录&#xff08;Memento&#xff09;设计模式是一种行为型设计模式&#xff0c;用于捕获一个对象的内部状态&#xff0c;并在对象之外保存这个状态&#xff0c;以便在需要时恢复对象到先前的状态。这种模…

JAVA for 循环训练 Pattern

import java.util.Scanner;public class Pattern {public static void main(String[] args) {int[] arr {0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0};Scanner in new Scanner(System.in);System.out.print("请输入n:");int n in.nextInt();in.close();for …

【小沐学GIS】电子海图OpenCPN源代码编译和运行(VS2017 + Win10)

1、简介 免费的开源海图仪和船用GPS导航软件 https://opencpn.org/ 1.1 OpenCPN概述 OpenCPN是一款自由软件&#xff08;GPLv2&#xff09;&#xff0c;用于创建简洁的海图绘图仪和导航软件&#xff0c;可以在航行过程中使用或者作为计划工具。OpenCPN提供大量免费海图下载&a…

「项目阅读系列」go-gin-example star 6.5k!(1)

文章目录 准备工作适宜人群项目信息 项目结构代码阅读主要模块代码主函数模块router 路由模块auth 授权模块数据库 修改文章请求分析其他依赖 总结 准备工作 适宜人群 初学 go 语法&#xff0c;希望了解 go 项目的构建过程和方式。 项目信息 go-gin-example 项目是使用 gin…

037、目标检测-SSD实现

之——简单实现 目录 之——简单实现 杂谈 正文 1.类别预测层 2.边界框预测 3.多尺度输出联结做预测&#xff08;提高预测效率&#xff09; 4.多尺度实现 5.基本网络块 6.完整模型 杂谈 原理查看&#xff1a;037、目标检测-算法速览-CSDN博客 正文 1.类别预测层 类别…

Python学习(一)基础语法

文章目录 1. 入门1.1 解释器的作用1.2 下载1.3 基础语法输入输出语法与引号注释&#xff1a;变量&#xff1a; 数据类型与四则运算数据类型四则运算数据类型的查看type()数据类型的转换int()、int()、float() 流程控制格式化输出循环与遍历逻辑运算符list遍历字典dict遍历 跳出…

HarmonyOS开发Java与ArkTS如何抉择

在“鸿蒙系统实战短视频App 从0到1掌握HarmonyOS”视频课程中&#xff0c;很多学员来问我&#xff0c;在HarmonyOS开发过程中&#xff0c;面对Java与ArkTS&#xff0c;应该选哪样&#xff1f; 本文详细分析Java与ArkTS在HarmonyOS开发过程的区别&#xff0c;力求解答学员的一些…

Navicat 基于 GaussDB 主备版的快速入门

Navicat Premium&#xff08;16.2.8 Windows版或以上&#xff09; 已支持对GaussDB 主备版的管理和开发功能。它不仅具备轻松、便捷的可视化数据查看和编辑功能&#xff0c;还提供强大的高阶功能&#xff08;如模型、结构同步、协同合作、数据迁移等&#xff09;&#xff0c;这…

12-1- GAN -简单网络-线性网络

功能 随机噪声→生成器→MINIST图像。 训练方法 0 损失函数:gan的优化目标是一个对抗损失,是二分类问题,用BCELoss 1 判别器的训练,首先固定生成器参数不变,其次判别器应当将真实图像判别为1,生成图像判别为0 loss=loss(real_out, 1)+loss(fake_out, 0) 2 生成器的…

【Linux】-进程间通信-匿名管道通信(以及模拟一个进程池)

&#x1f496;作者&#xff1a;小树苗渴望变成参天大树&#x1f388; &#x1f389;作者宣言&#xff1a;认真写好每一篇博客&#x1f4a4; &#x1f38a;作者gitee:gitee✨ &#x1f49e;作者专栏&#xff1a;C语言,数据结构初阶,Linux,C 动态规划算法&#x1f384; 如 果 你 …

ESP32 Arduino实战协议篇-搭建独立的 Web 服务器

在此项目中,您将创建一个带有 ESP32 的独立 Web 服务器,该服务器使用 Arduino IDE 编程环境控制输出(两个 LED)。Web 服务器是移动响应的,可以使用本地网络上的任何浏览器设备进行访问。我们将向您展示如何创建 Web 服务器以及代码如何逐步工作。 项目概况 在直接进入项目…