1. 程式人生 > 其它 >從零開始搭建Go語言開發環境

從零開始搭建Go語言開發環境

從零開始搭建Go語言開發環境

https://www.liwenzhou.com/posts/Go/install_go_dev/

Apollo配置中心

https://www.liwenzhou.com/posts/Go/apollo/
Apollo(阿波羅)是攜程開源的一款可靠的分散式配置管理中心,它能夠集中化管理應用不同環境、不同叢集的配置,配置修改後能夠實時推送到應用端,並且具備規範的許可權、流程治理等特性,適用於微服務配置管理場景。

Apollo(阿波羅)是攜程開源的一款可靠的分散式配置管理中心,它能夠集中化管理應用不同環境、不同叢集的配置,配置修改後能夠實時推送到應用端,並且具備規範的許可權、流程治理等特性,適用於微服務配置管理場景。

https://hub.fastgit.xyz
git clone https://github.com/apolloconfig/apollo.git
https://github.com/apolloconfig/apollo-quick-start.git
https://github.com/apolloconfig/apollo-quick-start
git clone https://hub.fastgit.xyz/apolloconfig/apollo-quick-start.git
https://github.com/apolloconfig/apollo-use-cases.git
https://hub.fastgit.xyz/apolloconfig/apollo-use-cases.git

cd apollo/scripts/docker-quick-start/
docker-compose up
docker-compose up -d

http://localhost:8070
輸入使用者名稱apollo,密碼admin後登入管理後臺。

http://node-129:8070
apollo/admin

http://node-129:8070/user-manage.html
cw/123456
cw-cw7

演示環境(Demo):

http://106.54.227.205
賬號/密碼:apollo/admin

Apollo支援4個維度管理Key-Value格式的配置:

application (應用)
environment (環境)
cluster (叢集)
namespace (名稱空間)

Apollo
https://www.apolloconfig.com/#/zh/usage/apollo-user-guide

https://www.apolloconfig.com/#/zh/deployment/quick-start-docker?id=_12-下載docker-quick-start配置檔案
https://www.php.cn/docker/494260.html
https://blog.csdn.net/u010786653/article/details/120892594
https://blog.csdn.net/qq_41980563/article/details/121329133
https://docs.docker.com/compose/compose-file/compose-versioning/
https://www.cnblogs.com/dyd168/p/14279374.html
https://blog.csdn.net/qq_35995514/article/details/125468792
https://blog.csdn.net/u011628753/article/details/123093447
https://www.cnblogs.com/fengfengyang/p/16442146.html
https://github.com/apolloconfig/apollo-use-cases
http://www.kailing.pub/article/index/arcid/189.html

rm /usr/local/bin/docker-compose

docker version
docker-compose version
docker-compose up

curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

不支援 2.x version: '2'

curl -L https://github.com/docker/compose/releases/download/1.3.1/docker-compose-uname -s-uname -m > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

dnf install docker-compose # fedora
yum install docker-compose # CentOS 7/ RHEL7
apt-get install docker-compose # debian及其變種如Ubuntu
apk add docker-compose # alpine
pacman -S docker-compose # arch

https://blog.csdn.net/douju/article/details/122115630
mvn tomcat7:run
mvn spring-mvc-logger tomcat7:run

org.apache.tomcat.maven

D:\ws\gitee\apollo-use-cases\spring-boot-agent\apollo-agent\target\apollo-agent-1.0-SNAPSHOT.jar
-javaagent:xxx\apollo-agent-1.0-SNAPSHOT.jar
-Ddev_meta=http://127.0.0.1:8801
-Dapp.id=spring-boot-agent

-javaagent:D:\ws\gitee\apollo-use-cases\spring-boot-agent\apollo-agent\target\apollo-agent-1.0-SNAPSHOT.jar
-Ddev_meta=http://node-129:8070
-Denv=DEV
-Dapp.id=0x01

https://blog.csdn.net/qq_17555933/article/details/92180436
http://node-129:8080
http://node-129:8080/configs/0x01/default/application?ip=192.168.198.1

https://www.liangzl.com/get-article-detail-203030.html

http://node-129:8080/services/config?appId=0x01&ip=192.168.198.1

資料庫ApolloConfigDB中ServerConfig表的Key=eureka.service.url的資料項的Value值改為http://【宿主機IP】:8080/eureka/,
資料庫ApolloPortalDB的ServerConfig表中Key=apollo.portal.meta.servers項中value改為{"DEV":"http://【宿主機IP】:8080"}

GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON . TO 'guest_test'@'%' identified by '424b8yAJyCG2';
flush privileges ;
show grants for 'guest_test'@'%';

GRANT ALL PRIVILEGES ON . TO 'rt2'@'%' identified by '424b8yAJyCG2';
flush privileges ;
show grants for 'rt2'@'%';

GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY PASSWORD '*C46C75AFF375664D6B865E4B98C6A158F8DBD8DD' WITH GRANT OPTION;
192.168.40.129

http://192.168.40.129:8080/eureka/

{"DEV":"http://【宿主機IP】:8080"}
{"DEV":"http://192.168.40.129:8080"}

UPDATE ApolloPortalDB.ServerConfig SET Value = '{"DEV":"http://192.168.40.129:8080"}' WHERE Id = 8

Docker構建Apollo-配置IP遠端訪問

https://www.liangzl.com/get-article-detail-203030.html

apollo-quick-start

https://blog.csdn.net/wuesr/article/details/125979263
https://blog.csdn.net/qyt_722/article/details/117673648
https://blog.csdn.net/AAA31321/article/details/124175735

go version
go version go1.15.10 windows/amd64
go env -w GOPROXY=https://goproxy.cn,direct

預設GoPROXY配置是:GOPROXY=https://proxy.golang.org,direct,由於國內訪問不到https://proxy.golang.org,所以我們需要換一個PROXY,這裡推薦使用https://goproxy.io或https://goproxy.cn。