diff --git a/README.md b/README.md index 9b46932..ee2f15c 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Unless it's a critical issue, new releases typically go out over the weekend. At - Packets are bridged to kafka according to the configured rule. - Single-machine mode supports local storage BBolt, Badger and Redis. - Hook design pattern makes it easy to develop plugins for Auth, Bridge, and Storage. -- Cluster support is based on Gossip and Raft, [Click to Cluster README](cmd/cluster/README.md). +- Cluster support is based on Gossip and Raft, [Click to Cluster README](cluster/README.md). #### Roadmap - Dashboard. @@ -51,8 +51,8 @@ Comqtt can be used as a standalone broker. Simply checkout this repository and r ### Build ``` -cd cmd/single -go build -o comqtt cmd/single/main.go +cd cmd +go build -o comqtt ./single/main.go ``` ### Start ``` diff --git a/cmd/cluster/README.md b/cluster/README.md similarity index 97% rename from cmd/cluster/README.md rename to cluster/README.md index efe3b56..9927948 100644 --- a/cmd/cluster/README.md +++ b/cluster/README.md @@ -25,7 +25,8 @@ Of course, due to my busy work and lack of more production environment verificat ## Build ```shell -go build -o comqtt cmd/cluster/main.go +cd cmd +go build -o comqtt cluster/main.go ``` ## Usage @@ -35,7 +36,7 @@ go build -o comqtt cmd/cluster/main.go Usage of ./comqtt: -conf string read the program parameters from the config file - + -storage-way uint storage way options:0 memory, 1 bolt, 2 badger, 3 redis (default 3) -auth-ds uint @@ -90,13 +91,13 @@ Usage of ./comqtt: The startup supports two modes: command parameters and configuration file. -It is recommended that you use the configuration file mode for more detailed configuration.[Click to config example](../config/node1.yml). +It is recommended that you use the configuration file mode for more detailed configuration.[Click to config example](../cmd/config/node1.yml). -All configuration file examples are in the cmd/config directory. [Click to config examples](../config) +All configuration file examples are in the cmd/config directory. [Click to config examples](../cmd/config) ### Configure Redis -Start redis and configure redis addr, [click to config example](../config/node1.yml). +Start redis and configure redis addr, [click to config example](../cmd/config/node1.yml). ### Create Cluster diff --git a/cmd/config/node1.yml b/cmd/config/node1.yml index f5c9e00..2ed034f 100644 --- a/cmd/config/node1.yml +++ b/cmd/config/node1.yml @@ -1,13 +1,13 @@ storage-way: 3 #Storage way optional items:0 memory、1 bolt、2 badger、3 redis;Only redis can be used in cluster mode. -bridge-way: 0 #Bridge way optional items:0 disable、1 kafka -bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path +bridge-way: 1 #Bridge way optional items:0 disable、1 kafka +bridge-path: ./config/bridge-kafka.yml #The bridge config file path pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060 auth: way: 0 #Authentication way: 0 anonymous, 1 username and password, 2 clientid datasource: 1 #Optional items:0 free、1 redis、2 mysql、3 postgresql、4 http ... - conf-path: ./cmd/config/auth-redis.yml #The config file path should correspond to the auth-datasource - blacklist-path: ./cmd/config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication + conf-path: ./config/auth-redis.yml #The config file path should correspond to the auth-datasource + blacklist-path: ./config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication cluster: discovery-way: 0 #The node discovery way in the cluster: 0 serf、1 memberlist、2 mDNS diff --git a/cmd/config/node2.yml b/cmd/config/node2.yml index 50849c1..1888224 100644 --- a/cmd/config/node2.yml +++ b/cmd/config/node2.yml @@ -1,13 +1,13 @@ storage-way: 3 #Storage way optional items:0 memory、1 bolt、2 badger、3 redis;Only redis can be used in cluster mode. bridge-way: 0 #Bridge way optional items:0 disable、1 kafka -bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path +bridge-path: ./config/bridge-kafka.yml #The bridge config file path pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060 auth: way: 0 #Authentication way: 0 anonymous, 1 username and password, 2 clientid datasource: 1 #Optional items:0 free、1 redis、2 mysql、3 postgresql、4 http ... - conf-path: ./cmd/config/auth-redis.yml #The config file path should correspond to the auth-datasource - blacklist-path: ./cmd/config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication + conf-path: ./config/auth-redis.yml #The config file path should correspond to the auth-datasource + blacklist-path: ./config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication cluster: discovery-way: 0 #The node discovery way in the cluster: 0 serf、1 memberlist、2 mDNS diff --git a/cmd/config/node3.yml b/cmd/config/node3.yml index 0920128..f44abd0 100644 --- a/cmd/config/node3.yml +++ b/cmd/config/node3.yml @@ -1,13 +1,13 @@ storage-way: 3 #Storage way optional items:0 memory、1 bolt、2 badger、3 redis;Only redis can be used in cluster mode. bridge-way: 0 #Bridge way optional items:0 disable、1 kafka -bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path +bridge-path: ./config/bridge-kafka.yml #The bridge config file path pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060 auth: way: 0 #Authentication way: 0 anonymous, 1 username and password, 2 clientid datasource: 1 #Optional items:0 free、1 redis、2 mysql、3 postgresql、4 http ... - conf-path: ./cmd/config/auth-redis.yml #The config file path should correspond to the auth-datasource - blacklist-path: ./cmd/config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication + conf-path: ./config/auth-redis.yml #The config file path should correspond to the auth-datasource + blacklist-path: ./config/blacklist.yml #Special rules outside the usual rules (black and white list),this configuration is invalid for anonymous authentication cluster: discovery-way: 0 #The node discovery way in the cluster: 0 serf、1 memberlist、2 mDNS diff --git a/cmd/config/single.yml b/cmd/config/single.yml index b3269c2..ca42eac 100644 --- a/cmd/config/single.yml +++ b/cmd/config/single.yml @@ -1,13 +1,13 @@ storage-way: 1 #Storage way optional items:0 memory、1 bolt、2 badger、3 redis;Only redis can be used in cluster mode. storage-path: comqtt.db #Local storage path in single node mode. bridge-way: 0 #Bridge way optional items:0 disable、1 kafka -bridge-path: ./cmd/config/bridge-kafka.yml #The bridge config file path +bridge-path: ./config/bridge-kafka.yml #The bridge config file path pprof-enable: false #Whether to enable the performance analysis tool http://ip:6060 auth: way: 0 #Authentication way: 0 anonymous, 1 username and password, 2 clientid datasource: 1 #Optional items:0 free、1 redis、2 mysql、3 postgresql、4 http ... - conf-path: ./cmd/config/auth-redis.yml #The config file path should correspond to the auth-datasource + conf-path: ./config/auth-redis.yml #The config file path should correspond to the auth-datasource mqtt: tcp: :1883