...
Helm version v3+
Running Kubernetes cluster version 1.18.0 or higher
kubectl latest version
Info |
---|
When utilizing the Platform Operator, the default location for the |
...
|
\uD83D\uDCD8 Instructions
Ensure Proper Configurations:
To run HiveMQ without encountering errors, verify that your config.xml
file includes all the necessary configurations.
...
Updating Existing Deployment:
If you have an active HiveMQ deployment and wish to make adjustments, use the following command to retrieve the currently deployed
config.xml
:Code Block language bash kubectl describe configmap hivemq-configuration-<installation name> -n <namespace> | grep config.xml
Replace
<installation name>
with the actual installation name and<namespace>
with the Kubernetes namespace.You can also get it from hivemq pod, File is located at
/opt/hivemq/conf/k8s/config.xml
Starting Fresh:
If you are starting a new HiveMQ deployment, obtain the template with the following command. Copy the contents of config.xml
from the generated template and apply the necessary modifications:
...
language | bash |
---|
...
In the HiveMQ Platform Helm chart, it is possible to override the default HiveMQ config.xml from a config map.
Prepare the config map manifest,
hivemq-configuration-override.yml
. Note that the config map contains two keys:config.xml
andtracing.xml
.
| grep config.xmlCode Block language yaml # Source: hivemq-platform/templates/hivemq-configuration.yml
Adjust the installation name and namespace as needed. After editing
config.xml
, implement the updated configuration to your HiveMQ deployment.Edit the config.xml file for the adding configurations. For instance, let's set max-queue-size:
Code Block language xml apiVersion: v1 kind: ConfigMap metadata: name: hivemq-configuration-broker-override namespace: hivemq data: # noinspection XmlPathReference config.xml: |- <?xml version="1.0"?> <hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd"> <mqtt><listeners> <queued-messages> <tcp-listener> <port>1883</port> <max-queue-size>500</max-queue-size><bind-address>0.0.0.0</bind-address> </tcp-listener> <tls-websocket-listener> <strategy>discard</strategy><port>8000</port> </queued-messages><bind-address>0.0.0.0</bind-address> </mqtt><path>/mqtt</path> <tls> <listeners> <tcp-listener> <keystore> <port>1883</port> <bind-address>0.0.0.0</bind-address><path>/path/to/broker-keystore.jks</path> </tcp-listener><password>${ENV:BROKER_KEYSTORE_PASS}</password> <websocket-listener><private-key-password>${ENV:BROKER_KEY_PASSPHRASE}</private-key-password> <port>8001</port></keystore> <bind-address>0.0.0.0</bind-address><client-authentication-mode>NONE</client-authentication-mode> </tls> </tls-websocket-listener> </listeners> <cluster> <transport> <tcp> <bind-address>0.0.0.0</bind-address> <bind-port>7000</bind-port> </tcp> </transport> <enabled>true</enabled> <discovery> <extension/> </discovery> </cluster> <!-- required and should not be configured different --> <health-api> <enabled>true</enabled> <listeners> <http> <port>8889</port> <bind-address>0.0.0.0</bind-address> </http> </listeners> </health-api> <!-- --> <control-center> <listeners> <http> <port>8080</port> <bind-address>0.0.0.0</bind-address> </http> </listeners> </control-center> </hivemq> tracing.xml: |- <?xml version="1.0" encoding="UTF-8" ?> <tracing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="tracing.xsd"> <context-propagation> <anonymous <outbound-usagecontext-statistics>propagation> <enabled>false</enabled> </anonymousoutbound-usagecontext-statistics>propagation> </hivemq>
You have two options to override HiveMQ's configuration.
Option 1: Using overrideHiveMQConfig in Helm:
Code Block language bash helm upgrade --install -f hivemq_values.yaml <installation name> hivemq/hivemq-platform --set-file config.overrideHiveMQConfig=config.xml -n <namespace>
Option 2: Using ConfigMap: Create a ConfigMap using the Create the config map.
createCode Block language bash kubectl
configmapapply
--from-file config.xml -n <namespace>Edit hivemq_-f hivemq-configuration
-override.yml --namespace hivemq
Update the HiveMQ Platform values.yaml, disable to
add the ConfigMap name and setcreate
to false:create the config map (
create: false
), and specify the new name of the config map (name: "hivemq-configuration-broker-override"
).
...Code Block language yaml config:
create: false
name: "hivemq-configuration-broker-override" overrideHiveMQConfig: "" overrideStatefulSet: "" overrideInitContainers: ""
Update the HiveMQ Platform.
Code Block language yaml helm upgrade broker --install hivemq/hivemq-platform --values values.yaml
Check Pod Status:
Verify that all hivemq pods are runningSpecify the updated in the step 3 values.yaml in the
--values values.yaml
Check the broker pods status and ensure that all pods are running and all containers are ready.
Code Block language bash kubectl get pods -n <namespace>
Verify log:
Check--namespace hivemq -o wide
Review the content of the
config.xml
file on the broker pod and make sure that it is overridden:Code Block language bash kubectl exec broker-0 -c hivemq -- cat conf-k8s/config.xml
Review the
hivemq.log
to confirm thatconfig.xml
is loaded successfully.Code Block kubectl logs <pod name> -n <namespace>
Perform Quick Tests:
Utilize the MQTT CLI to conduct quick tests to verify changes
config.xml
file:context-propagation>
<sampling>
<publish-sampling>
<enabled>true</enabled>
</publish-sampling>
</sampling>
</tracing> |
...
\uD83D\uDCCB Related articles
...