下載到原生的檔案,我下載兩個,一個是 JDK,一個是 JRE,大家只下載一個就好。
2)、安裝JDK步驟沒有什麼可說的,直接下一步就可以,根據自己的需求更改就可以。
右鍵」計算機」 => 」屬性」 => 」高階系統設定」 => 」高階」 => 「環境變數」 => 「系統變數」。
變數名:JAVA_HOME
變數值:D:\program files\Java\jdk-1.8【具體要根據你自己的安裝路徑,我的是安裝在D槽的】
變數名:CLASSPATH
變數值:%JAVA_HOME%/lib/dt.jar;%JAVA_HOME/%/lib/tools.jar
2、下載、設定 Apollo 伺服器。
成功建立資料夾。
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2 <!-- 3 Licensed to the Apache Software Foundation (ASF) under one or more 4 contributor license agreements. See the NOTICE file distributed with 5 this work for additional information regarding copyright ownership. 6 The ASF licenses this file to You under the Apache License, Version 7 2.0 (the "License"); you may not use this file except in compliance 8 with the License. You may obtain a copy of the License at 9 http://www.apache.org/licenses/LICENSE-2.0 Unless required by 10 applicable law or agreed to in writing, software distributed under 11 the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 12 OR CONDITIONS OF ANY KIND, either express or implied. See the 13 License for the specific language governing permissions and 14 limitations under the License. 15 --> 16 17 <!-- 18 For more information on how configure this file please 19 reference: 20 21 http://activemq.apache.org/apollo/versions/1.7.1/website/documentation/user-manual.html 22 --> 23 <broker xmlns="http://activemq.apache.org/schema/activemq/apollo"> 24 25 <notes> 26 The default configuration with tls/ssl enabled. 27 </notes> 28 29 <log_category console="console" security="security" connection="connection" audit="audit"/> 30 31 32 <authentication domain="apollo"/> 33 <!-- Give admins full access --> 34 <access_rule allow="admins" action="*"/> 35 <access_rule allow="*" action="connect" kind="connector"/> 36 37 38 <virtual_host id="mqttServer"> 39 <!-- 40 You should add all the host names that this virtual host is known as 41 to properly support the STOMP 1.1 virtual host feature. 42 --> 43 <host_name>mqttServer</host_name> 44 <host_name>localhost</host_name> 45 <host_name>127.0.0.1</host_name> 46 47 <!-- Uncomment to disable security for the virtual host --> 48 <!-- <authentication enabled="false"/> --> 49 50 <!-- Uncomment to disable security for the virtual host --> 51 <!-- <authentication enabled="false"/> --> 52 <access_rule allow="users" action="connect create destroy send receive consume"/> 53 54 55 <!-- You can delete this element if you want to disable persistence for this virtual host --> 56 <leveldb_store directory="${apollo.base}/data"/> 57 58 59 </virtual_host> 60 //Web網站系統存取的IP地址,127.0.0.1,這樣定義只能內網存取,如果想外網存取,改成:0.0.0.0,格式:http://1**.9*.11*.1**:61680/console/index.html# 61 <web_admin bind="http://0.0.0.0:61680"/> 62 <web_admin bind="https://0.0.0.0:61681"/> 63 //這是MQTT伺服器的地址,在使用MQTT使用者端存取MQTT伺服器的格式:雲伺服器公網地址(不是執行ipconfig獲取的地址):埠號,格式:1**.9*.11*.1**:61613 64 <connector id="tcp" bind="tcp://0.0.0.0:61613" connection_limit="2000"/> 65 <connector id="tls" bind="tls://0.0.0.0:61614" connection_limit="2000"/> 66 <connector id="ws" bind="ws://0.0.0.0:61623" connection_limit="2000"/> 67 <connector id="wss" bind="wss://0.0.0.0:61624" connection_limit="2000"/> 68 69 <key_storage file="${apollo.base}/etc/keystore" password="password" key_password="password"/> 70 71 </broker>
原始碼如下:
1 ## --------------------------------------------------------------------------- 2 ## Licensed to the Apache Software Foundation (ASF) under one or more 3 ## contributor license agreements. See the NOTICE file distributed with 4 ## this work for additional information regarding copyright ownership. 5 ## The ASF licenses this file to You under the Apache License, Version 2.0 6 ## (the "License"); you may not use this file except in compliance with 7 ## the License. You may obtain a copy of the License at 8 ## 9 ## http://www.apache.org/licenses/LICENSE-2.0 10 ## 11 ## Unless required by applicable law or agreed to in writing, software 12 ## distributed under the License is distributed on an "AS IS" BASIS, 13 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ## See the License for the specific language governing permissions and 15 ## limitations under the License. 16 ## --------------------------------------------------------------------------- 17 18 # 19 # The list of users that can login. This file supports both plain text or 20 # encrypted passwords. Here is an example what an encrypted password 21 # would look like: 22 # 23 # admin=ENC(Cf3Jf3tM+UrSOoaKU50od5CuBa8rxjoL) 24 # 25 26 admin=password
原始碼如下:
1 ## --------------------------------------------------------------------------- 2 ## Licensed to the Apache Software Foundation (ASF) under one or more 3 ## contributor license agreements. See the NOTICE file distributed with 4 ## this work for additional information regarding copyright ownership. 5 ## The ASF licenses this file to You under the Apache License, Version 2.0 6 ## (the "License"); you may not use this file except in compliance with 7 ## the License. You may obtain a copy of the License at 8 ## 9 ## http://www.apache.org/licenses/LICENSE-2.0 10 ## 11 ## Unless required by applicable law or agreed to in writing, software 12 ## distributed under the License is distributed on an "AS IS" BASIS, 13 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 ## See the License for the specific language governing permissions and 15 ## limitations under the License. 16 ## --------------------------------------------------------------------------- 17 18 # 19 # Allows you to place multiple users in a group. 20 # Example: 21 # 22 # power_users=admin|chirino 23 # 24 admins=admin
7)、使用者端(外網使用者端和伺服器本地,存取方式不同)測試執行。
2】、通過services.msc 命令檢視服務。
【2】、開啟設定視窗如下:
【3】、回到主介面,點選connect連線到MQTT 代理伺服器上,就可以進行訂閱和釋出訊息測試了。
【4】、Publish 釋出測試。(主題:這是測試,內容:this is my test 2023.7.13)
【5】Subscribe即訂閱(訂閱該主題之後,每次釋出訊息均會收到通知)
【6】、連結成功之後,在apache-apollo管理平臺可以看到有一個連結存在了