NATS的使用 1 NATS介紹

2021-10-01 05:01:53 字數 1997 閱讀 3090

nats官網

nats是乙個高效能的訊息中介軟體。

執行

單個執行方式

nats-server -d -p 4222

集群執行模式

a:nats-server -d -p 4222 -cluster nats://localhost:6222

b:nats-server -d -p 4333 -cluster nats://localhost:6333 -routes nats://localhost:6222

c:nats-server -d -p 4444 -cluster nats://localhost:6444 -routes nats://localhost:6222

d:nats-server -d -p 4555 -cluster nats://localhost:6555 -routes nats://localhost:6222,nats://localhost:6333

-cluster nats://localhost:6222 表示開啟集群,其它nats-server可以通過6222埠與之建立集群

-routes nats://localhost:6222 連線到開啟6222埠的nats-server與其建立集群

以配置檔案執行

#與其它nats-server建立集群,主節點為空

routes = ["nats://abc:abc123456@localhost:7223","nats://abc:abc123456@localhost:7224"]

}#客戶端的連線認證

#tls:

#authorization

#authorization: ,

#

# ]

#}#authorization:

#

客戶端連線
cd := &customdialer

opts := nats.option),

nats.disconnecthandler(func(c *nats.conn) ),

nats.closedhandler(func(c *nats.conn) ),

nats.noreconnect(),

nats.clientcert("d:\\cert\\client\\client.crt", "d:\\cert\\client\\client_rsa_private.pem.unsecure"),

nats.rootcas("d:\\cert\\ca.crt"),

nats.userinfo("admin", "admin"),

"abc123"), //nc, err = nats.connect("abc123@server:4224", opts...)

// nats.userjwt(),

// nats.dialer(),

} nc, err := nats.connect("server:42242", opts...)

一種開源的分布式訊息系統Nats

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!與activemq kafka kestrel nsq rabbitmq redis在broker吞吐量方面的比較 nats伺服器 用golang語言開發,發行版包括二進位制發布包和docker映象。nats客戶端 包含了多種語言的客戶端。官方提供...

一種開源的分布式訊息系統Nats

與activemq kafka kestrel nsq rabbitmq redis在broker吞吐量方面的比較 nats伺服器 用golang語言開發,發行版包括二進位制發布包和docker映象。nats客戶端 包含了多種語言的客戶端。官方提供的客戶端 還有社群提供的客戶端 客戶端api文件 對...

QEMU KVM 介紹1 使用與安裝

開發環境 thinkpad t470 軟體環境 vmware 安裝centos7.2 使能intel vt與ept 1.確認系統cpu 支援硬體虛擬化 grep e vmx svm proc cpuinfo git clone git 3.編譯並安裝qemu configure target lis...