输入mosquitto -h:
mosquitto version 2.0.11
mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
See https://mosquitto.org/ for more information
- -c表示指定
mosquitto的配置文件(默认是:/etc/mosquitto/mosquitto.conf) - -d表示启动一个后台进程(也就是守护进程)来运行我们的服务器
- -p指定端口号
启动服务器的方法:
mosquitto -c /etc/mosquitto/mosquitto.conf -p 1883
和
service mosquitto start
这两个命令是相同的。因为默认的配置文件就是/etc/mosquitto/mosquitto.conf,默认的端口号就是1883。
我们想看有没有启动成功可以执行:
la@lll:~$ ps -aux | grep mosquitto
mosquit+ 16064 0.0 0.0 15772 8120 ? Ss 15:05 0:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
la@lll:~$
杀进程 kill -9 16064。br>
如果我们的服务器没有启动执行命令mosquitto_sub -t "test"会报错:
la@lll:~$ mosquitto_sub -t "test"
Error: Connection refused
la@lll:~$
ActiveMq服务器的部署:
- 官方下载:activemq.apache.org
- 启动 ./activemq start
- 查看是否启动:
ps -ef|grep java |grep -v grep
netstat -anp|grep 61616
lsof -i:61616
启动后的网址:http://localhost:8161/
有的时候启动失败了,日至会保存在:apache-activemq-5.17.2/data/activemq.log。报错信息里面如果讲的是端口占用,那我们可以进入apache-activemq-5.17.2/conf/activemq.xml修改端口号。