只问一个愚蠢的问题,希望有人能回答这个问题.
关于MQTT经纪人,我有点困惑.基本上,令人困惑的是,有很多东西被用于数据存储,传输和处理(如Flume,HDInsight,Spark等).那么,何时以及为什么我需要使用一个MQTT代理?
如果我想在HiveMQ中使用Windows 10 IoT应用程序,我可以从哪里获取详细信息?如何使用它?我如何从这个MQTT经纪人那里获益?我是否可以不使用Azure或HDFS直接从我的IoT应用程序发送数据?那么,MQTT经纪人如何融入其中或帮助我实现某些目标呢?
我是所有这些的新手,并试图找到一些教程,但是,我没有得到任何正确的.请详细解释一下,或者为此提供一些教程?
我需要创建一个服务器场,可以处理500多万个连接,500多万个主题(每个客户端一个),处理300k消息/秒.
我试图了解各种消息代理的功能,因此我目前正在使用两个RHEL EC2实例(r3.4xlarge)来创建大量可用资源.所以你不需要查找它,它有16vCPU,122GB RAM.我没有接近使用限制.
我无法通过600k连接限制.因为在客户端和服务器上似乎没有任何O/S限制(大量的RAM/CPU /等)限制了我?
我编辑了/etc/security/limits.conf如下:
* soft nofile 20000000
* hard nofile 20000000
* soft nproc 20000000
* hard nproc 20000000
root soft nofile 20000000
root hard nofile 20000000
Run Code Online (Sandbox Code Playgroud)
我编辑了/etc/sysctl.conf如下:
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 5242880 5242880 5242880
net.ipv4.tcp_tw_recycle = 1
fs.file-max = 20000000
fs.nr_open = 20000000
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_max_syn_backlog = 10000
net.ipv4.tcp_synack_retries = 3
net.core.somaxconn=65536
net.core.netdev_max_backlog=100000
net.core.optmem_max = 20480000
Run Code Online (Sandbox Code Playgroud)
对于Apollo:导出APOLLO_ULIMIT = 20000000
对于ActiveMQ:
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.UseDedicatedTaskRunner=false"
ACTIVEMQ_OPTS_MEMORY="-Xms50G -Xmx115G"
Run Code Online (Sandbox Code Playgroud)
我在客户端为eth0创建了20个额外的私有地址,然后分配它们:ip addr add 11.22.33.44/24 dev …
我正在尝试在Android Studio中使用Paho-MQTT。我提到了此链接 ,我应该在gradle文件中添加以下内容
该链接要求添加以下内容:
repositories {
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
dependencies {
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
}
Run Code Online (Sandbox Code Playgroud)
文本未指定我使用哪个gradle文件使用“ gradle-proj或gradle-app”,因此我同时尝试了这两种方法,在两种情况下,我都收到诸如
Error:(14, 0) Could not find method compile() for arguments [org.eclipse.paho:org.eclipse.paho.android.service:1.0.2, build_9fu4g5nmegp97bvhjazm7s8o8$_run_closure1$_closure3$_closure5@6dff2815] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
<a href="openFile:C:\Users\aba\AndroidStudioProjects\Test-PahoMQTT-1\build.gradle">Open File</a>
Run Code Online (Sandbox Code Playgroud)
请让我知道我应该使用“ proj或app”哪个gradle文件?以及如何正确地添加以前的代码来gradle?
build.gradle应用程序:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.alten.test_pahomqtt_1"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), …Run Code Online (Sandbox Code Playgroud) 我有一个 MQTT 客户端想要订阅以下主题
当然,我有多个节点,所以我必须使用通配符,如下所述: https: //www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/
我尝试了以下主题名称
使用上述表达式 1 和 2,我没有收到主题 node1/data 的消息。
有没有办法通过单个订阅来做到这一点?
我一直在尝试在我的 Android 应用程序中使用 hivemq 实现 mqtt。尽管我使用了他们文档中的相同规格和配置,但我仍然无法建立成功的连接。
我之前能够将 paho 用于 mqtt,但如果应用程序处于后台,则它不适用于 android Oreo 及更高版本,因为该库没有 startServiceForeground 更新。因此转移到 HiveMq。我只是使用此处的快速入门指南尝试他们的示例应用程序。1. https://hivemq.github.io/hivemq-mqtt-client/ 2. https://www.hivemq.com/blog/mqtt-client-library-enyclopedia-hivemq-mqtt-client/ 3. https: //github.com/hivemq/hivemq-mqtt-client/blob/develop/README.md 几乎浪费了一天的时间来弄清楚如何连接到他们的 mqtt,但不成功
lateinit var client : Mqtt3Client
fun connect() {
client = Mqtt3Client.builder()
.identifier(UUID.randomUUID().toString())
.serverHost("broker.hivemq.com")
.serverPort(1883)
.buildAsync()
client.toAsync().connect()
.whenComplete { mqtt3ConnAck, throwable ->
if (throwable != null) {
// handle failure
android.util.Log.v("HIVE-MQTT-LCDP", " connection failed")
} else {
android.util.Log.v("HIVE-MQTT-LCDP", " connected")
// setup subscribes or start publishing
subscribe()
publish()
}
}
fab.setOnLongClickListener {
android.util.Log.v("HIVE-MQTT-LCDP", " disconnected")
client.toAsync().disconnect()
true …Run Code Online (Sandbox Code Playgroud) 我在 Spring 中使用 HiveMQ MQTT 客户端来接收 MQTT 消息。
我的客户端配置如下
public Mqtt3AsyncClient mqtt3Client() {
var mqtt3Client = Mqtt3Client.builder()
.serverHost("my.host")
.sslWithDefaultConfig()
.serverPort(0000)
.automaticReconnectWithDefaultConfig()
.buildBlocking();
mqtt3Client.connect();
return mqtt3Client.toAsync();
}
Run Code Online (Sandbox Code Playgroud)
客户端可用后,使用该客户端初始化另一个 Spring Bean。它订阅了一个主题:
@PostConstruct
public void subscribeTopic() {
mqtt3AsyncClient.subscribeWith()
.topicFilter("topicfilter")
.qos(MqttQos.AT_LEAST_ONCE)
.callback(message -> {
/*Handle message*/
})
.send()
.whenComplete((mqtt3SubAck, throwable) -> {
if (throwable != null) {
/*Logging*/
} else {
/*Logging*/
}
});
}
Run Code Online (Sandbox Code Playgroud)
我多次看到没有更多消息传递到我的应用程序,而我仍然能够使用客户端连接发送消息(因此当时它已连接)。
我找不到任何有关 HiveMQ MQTT 客户端如何处理配置的automaticReconnectWithDefaultConfig(). 谁能指出,我创建的订阅是否subscribeTopic()被重新订阅?addSubscription()我还找到了可以更换零件的方法.topicFilter(..).qos(...)。我也找不到任何信息这是否使订阅对连接丢失更具弹性。
我很感激有关该主题的任何信息。
谢谢。
我对不同的消息代理感到困惑。
我的设备正在使用 MQTT。到目前为止,我已经研究过 HiveMQ、IBM Messagesight、RabbitMQ、google pub and sub、AWS SQS。
HiveMQ(MQTT消息代理)和RabbitMQ(或pub and sub,SQS)有什么区别?
除了协议和成本可能不同之外,它们的功能有什么区别吗?还有一个问题,IBM messagesight 是一种消息代理吗?它与 google pub and sub 或rabbit 有什么不同吗?
我找不到任何有关 messagesight 的信息。
我正在使用HiveMQ Java客户端连接到HiveMQ代理。阻止客户端订户不使用任何消息。使用MQTTBox,发布和订阅可以正常工作。这是代码。我正在关注 HiveMQ Java客户端文档
public class MQTTMain {
public static void main(String[] args) {
Mqtt3BlockingClient pubClient = MqttClient.builder()
.useMqttVersion3()
.identifier("pub")
.serverHost("hostaddress")
.serverPort(1883)
.buildBlocking();
Mqtt3BlockingClient subClient = MqttClient.builder()
.useMqttVersion3()
.identifier("sub")
.serverHost("hostaddress")
.serverPort(1883)
.buildBlocking();
pubClient.connectWith().keepAlive(10000).send();
publish(pubClient, "test/topic", "test");
subClient.connectWith().keepAlive(10000).send();
subscribe(subClient, "test/topic");
while (true) {
}
}
public static void subscribe(Mqtt3BlockingClient client, String topic) {
try (final Mqtt3Publishes publishes =
client.publishes(MqttGlobalPublishFilter.ALL)) {
try {
publishes.receive(1, TimeUnit.SECONDS)
.ifPresent(System.out::println);
publishes.receive(10000, TimeUnit.MILLISECONDS)
.ifPresent(System.out::println);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} …Run Code Online (Sandbox Code Playgroud) 在Google Chrome上执行mqttws31.js作为HTML文件的一部分时,我遇到以下错误.
HiveMQ用作MQTT代理,日志如下
2014-10-28 14:46:45,043 INFO - HiveMQ home directory: E:\hivemq-2.1.0
2014-10-28 14:46:45,065 INFO - Starting HiveMQ Server
2014-10-28 14:46:48,249 WARN - No license file found. Using free personal licensing with restrictions to 25 connections.
2014-10-28 14:46:48,367 INFO - Activating statistics callbacks with an interval of 60 seconds
2014-10-28 14:46:48,368 INFO - Activating $SYS topics with an interval of 60 seconds
2014-10-28 14:46:48,728 INFO - Starting on address 127.0.0.1 and port 1883
2014-10-28 14:46:48,734 INFO - Started HiveMQ 2.1.0 in …Run Code Online (Sandbox Code Playgroud) 我做了两台服务器,一台是虚拟测试服务器,另一台是我的django项目正在运行的地方。我可以在虚拟服务器上运行hivemq服务器,但在尝试在项目服务器上运行它时抛出错误。
java.lang.ExceptionInInitializerError: null
at org.jgroups.logging.LogFactory.getLog(Unknown Source)
at org.jgroups.blocks.MessageDispatcher.<init>(Unknown Source)
at b.a.a(Unknown Source)
at com.hivemq.HiveMQEnterpriseServer.b(Unknown Source)
at com.hivemq.HiveMQEnterpriseServer.a(Unknown Source)
at com.hivemq.HiveMQEnterpriseServer.main(Unknown Source)
Caused by: java.lang.NullPointerException: null
at java.base/java.util.Locale.<init>(Locale.java:713)
at java.base/java.util.Locale.<init>(Locale.java:742)
at org.jgroups.logging.Slf4jLogImpl.<clinit>(Unknown Source)
... 6 common frames omitted
Run Code Online (Sandbox Code Playgroud) 我正在深入研究HiveMQ插件开发.我开发了基于AfterLoginCallback的自定义功能.我配置了一个有效的TLS连接,我可以连接客户端证书.
mosquitto_pub.exe -t test -m "testMessage" --cafile myCertificates/hivemq-server-cert.pem --cert myCertificates/sender.crt --key myCertificates/sender.key -p 8883"
Run Code Online (Sandbox Code Playgroud)
但是,当我调试AfterLoginCallback代码时,我发现我的"ClientData - > certificate"为"null",在访问时抛出IllegalStateExcpetion.
[INFO] java.lang.IllegalStateException: Optional.get() cannot be called on an absent value
[INFO] at com.google.common.base.Absent.get(Unknown Source)
[INFO] at mycode.hivemq.plugins.first_plugin.callbacks.AfterLoginCallbackTest.afterSuccessfulLogin(AfterLoginCallbackTest.java:33)
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释,为什么证书是空的?
谢谢,Lomungo
我正在编写一个主类,它将创建一些客户并测试他们的订阅和发布。我想显示客户端连接的信息,例如连接的数据和时间,clientId,用于连接的clientIP,无论它们是否正常连接。我是使用Logger之类的工具的新手,所以我不确定该怎么做。我留下了指向HiveMQ社区版(经纪人)和客户端的链接。我想在HiveMQ客户端项目的主类中显示此信息,但是社区版中有一个名为event.log的日志文件,其中包含我要显示的信息的确切类型。我在下面留下了一张图片。
HiveMQ:
https://github.com/hivemq/hivemq-community-edition https://github.com/hivemq/hivemq-mqtt-client
hivemq-community-edition中有一个event.log文件,其中包含我想显示的信息。它是在我将项目构建为Gradle项目时生成的,因此除非将其导入Eclipse并使用Gradle构建,否则不会找到它,因此我留下了它的屏幕截图。
HiveMQ Client中我的主类中的代码:
package com.main;
import java.util.UUID;
import com.hivemq.client.mqtt.MqttGlobalPublishFilter;
import com.hivemq.client.mqtt.datatypes.MqttQos;
import com.hivemq.client.mqtt.mqtt5.Mqtt5BlockingClient;
import com.hivemq.client.mqtt.mqtt5.Mqtt5BlockingClient.Mqtt5Publishes;
import com.hivemq.client.mqtt.mqtt5.Mqtt5Client;
import com.hivemq.client.mqtt.mqtt5.message.publish.Mqtt5Publish;
import java.util.logging.Logger;
import java.util.NoSuchElementException;
import java.util.logging.Level;
import java.util.concurrent.TimeUnit;
public class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class.getName()); // Creates a logger instance
public static void main(String[] args) {
Mqtt5BlockingClient client1 = Mqtt5Client.builder()
.identifier(UUID.randomUUID().toString()) // the unique identifier of the MQTT client. The ID is randomly generated between
.serverHost("localhost") // the host name or IP address …Run Code Online (Sandbox Code Playgroud)