kzdgt Blog

路在脚下,心向远方

部署etcd

部署etcd

安装部署 docker pull bitnami/etcd docker run -d --name etcd-server \ --network mynet2 \ --publish 2379:2379 \ --publish 2380:2380 \ --env ALLOW_NONE_AUTHENTICATION=yes \ --env ETCD_ADVERTISE_CLIENT_URLS=http://0.0.0.0:2379 \ bitnami/etcd:latest go get go.etcd.io/etcd/client/v3 put和get,以及watch操作 package main import ( "context" "fmt" "go.etcd.io/etcd/client/v3" "net" "strings" "time" ) var cli *clientv3.Client func main() { var err error cli,

部署influexDB

部署influexDB

官方文档 官方文档很详细,有安装教程和示例 Install InfluxDB | InfluxDB OSS 2.4 Documentation (influxdata.com) 安装部署 docker pull influxdb docker run -id --name influxdb -p 8086:8086 influxdb docker exec -it influxdb /bin/bash # influxDB 1.x版本 示例使用1.x版本 go get github.com/influxdata/influxdb1-client/v2 # influxDB 2

kafka学习笔记

kafka学习笔记

安装 使用docker-compose部署kafka和zookeeper version: '3' services: zoo1: image: wurstmeister/zookeeper ports: - "2181:2181" hostname: zoo1 container_name: zookeeper kafka: image: wurstmeister/kafka depends_on: - zoo1 ports: - "9092:9092" environment: KAFKA_ADVERTISED_HOST_NAME: 114.116.21.20 KAFKA_CREATE_TOPICS: "sun:1:1" KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zoo1:2181 container_name: kafka

Go 字符串拼接6种方式

最快的方式 -- strings.builder

定义 我们首先来了解一下Go语言中string类型的结构定义,先来看一下官方定义: // string is the set of all strings of 8-bit bytes, conventionally but not // necessarily representing UTF-8-encoded text. A string may be empty, but // not nil. Values of

ShowMeBug初级Golang面试

Golang面试

new和make的区别 二者都是用来做内存分配的。 make只用于slice、map以及channel的初始化,返回的还是这三个引用类型本身为这