cd /usr/local/src
wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gztar-xzvf jdk-8u201-linux-x64.tar.gz -C /usr/local#配置环境变量vim /etc/profile
#文末添加exportJAVA_HOME=/usr/local/jdk1.8.0_201
exportJRE_HOME=${JAVA_HOME}/jre
exportCLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
exportPATH=${JAVA_HOME}/bin:$PATHsource /etc/profile
java-versionjava version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM)64-Bit Server VM (build 25.201-b09, mixed mode)
kafka配置与部署
下载Kafka
https://kafka.apache.org/downloads
cd /usr/local/src
wget --no-check-certificate https://archive.apache.org/dist/kafka/2.7.2/kafka_2.13-2.7.2.tgztar-zxvf kafka_2.13-2.7.2.tgz -C /usr/local
配置Kafka
vim /usr/local/kafka_2.13-2.7.2/config/server.properties
broker.id=0listeners=PLAINTEXT://192.168.18.134:9092
advertised.listeners=PLAINTEXT://192.168.18.134:9092
log.dirs=/usr/local/kafka_2.13-2.7.2/kafka-logs
zookeeper.connect=192.168.18.134:2181
配置zookeeper
vim /usr/local/kafka_2.13-2.7.2/config/zookeeper.properties
dataDir=/usr/local/kafka_2.13-2.7.2/zookeeper-data
admin.enableServer=true
admin.serverPort=8081
启动脚本
cd /usr/local/kafka_2.13-2.7.2/
./bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
./bin/kafka-server-start.sh -daemon config/server.properties
查看Kafka队列topic信息数
cd /usr/local/kafka_2.13-2.7.2/bin
./kafka-topics.sh --zookeeper192.168.18.134:2181 --list
Gin 是一个 Go (Golang) 编写的轻量级 web 框架,运行速度非常快,擅长 Api 接口的高并发,如果项目的规模不大,业务相对简单,这个时候我们也推荐您使用 Gin,特别适合微服务框架。
简单路由配置
package mai…