大家好,又见面了,我是你们的朋友全栈君。
准备工作 由于搭建Apollo环境变量需要有JAVA_HOME,这个时候需要安装JDK,可以参考这篇文章:《Ubuntu安装JDK1.8.0并配置环境变量》。 下载及解压 首先是下载Apache-Apollo,下载页面:http://www.apache.org/dyn/closer.cgi?path=activemq/activemq-apollo/1.7.1/apache-apollo-1.7.1-unix-distro.tar.gz 或者输入下面命令 wget http://apache.fayea.com/activemq/activemq-apollo/1.7.1/apache-apollo-1.7.1-unix-distro.tar.gz 解压源码包 tar -zxvf apache-apollo-1.7.1-unix-distro.tar.gz 配置 进入apache-apollo-1.7.1/bin目录 cd apache-apollo-1.7.1/bin/ 输入./apollo可以查看帮助 ***@***-virtual-machine:~/Downloads/apache-apollo-1.7.1/bin$ ./apollousage: apollo [–log <log_level>] <command> [<args>]The most commonly used apollo commands are: create creates a new broker instance disk-benchmark Benchmarks your disk’s speed help Display help information version Displays the broker versionSee ‘apollo help <command>’ for more information on a specific command. 创建一个Broker示例:/apollo create mybroker,MQTT服务器都是叫Broker。 ***@***-virtual-machine:~/Downloads/apache-apollo-1.7.1/bin$ ./apollo create mybrokerCreating apollo instance at: mybrokerGenerating ssl keystore…You can now start the broker by executing: “/home/***/Downloads/apache-apollo-1.7.1/bin/mybroker/bin/apollo-broker” runOr you can setup the broker as system service and run it in the background: sudo ln -s “/home/***/Downloads/apache-apollo-1.7.1/bin/mybroker/bin/apollo-broker-service” /etc/init.d/ /etc/init.d/apollo-broker-service start 后面会有提示怎么启动服务器,以及创建一个service。 启动Apollo : ***@***-virtual-machine:~/Downloads/apache-apollo-1.7.1/bin$ ./mybroker/bin/apollo-broker run 之后查看打印信息即可知道MQTT要连接的端口和管理页面端口。 结束。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/142623.html原文链接:https://javaforall.cn