Determine version of mosquitto - mosquitto

I'm looking for a way to determine mosquitto's version BEFORE starting it.
Of course I could start it and subscribe to $SYS/broker/version.
For security reasons mosquitto needs an extended configuration file since version 2.0, which I have to generate depending on the found mosquitto version.
Since I'm starting a mosquitto process programmatically, I don't want to start a process, get the version, quit the process, and restart it with a different config file.
Unfortunately, the mosquitto.exe doesn't contain any version information, so GetFileVersionInfo does not work.
Is there any other reliable information to find out if it's a version less oder greater than 2.0?
Thanks,
Sören

What's wrong with mosquitto -h it outputs the version information in the first line and then exit on it's own:
$ mosquitto -h
mosquitto version 2.0.12
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.
Also you could just generate a valid 2.0 config file every time as this will still work with earlier versions of Mosquitto.

Related

ArangoDB unknown option --rocksdb.encryption-keyfile

I'm using ArangoDB 3.4.4 in a docker container (pulled from Docker Hub) and I'm attempting to implement encryption for the rocksdb engine as outlined on this page: https://docs.arangodb.com/3.4/Manual/Security/Encryption/
I've configured my docker-compose.yml file with this start up command:
command: 'arangod --rocksdb.encryption-keyfile=key.txt --server.storage-engine=rocksdb'
However it seems to ignore the --server.storage-engine flag and says it's choosing the default engine. But the larger issue is that it gives me the following error for the --rocksdb.encryption-keyfile flag:
Error while processing command-line options for arangod:
unknown option '--rocksdb.encryption-keyfile'
If I run an arangod --help command the --rocksdb.encryption-keyfile option that is shown in the documentation doesn't seem to exist. Any ideas?
The manual page you referenced states that
This feature is only available in the Enterprise Edition
As the server in your case does not understand the option, I am sure you are using the community version.
whether the server is an enterprise or a community build can be detected by running the --version command on the server executable.
This will show either "community" or "enterprise".

(using WSL ubuntu app) system has not been booted with system as init system (PID 1). Can't operate [duplicate]

This question already has an answer here:
Enable Systemd in WSL 2
(1 answer)
Closed 2 months ago.
I'm a very first user of Ubuntu. I failed to install Ubuntu in wmware ,so I installed Ubuntu application in Microsoft app store and everything was quite all right.
But when I insert shutdown or halt command to power off my ubuntu I kept getting 'system has not been booted with system as init system (PID 1). Can't operate' error message.
I tried to using docker following with this link (https://blog.jayway.com/2017/04/19/running-docker-on-bash-on-windows/) but I failed after going to Number 2 process many times. I'm not sure my failure is because of installing docker toll box instead of normal one. (my computer is just windows 10. not a windows pro)
I think I have to try other thing. If you don't mind me asking, how can I slove this problem?
(and one more. If I just click 'X' button at the top of right side, is it different with shutting down Ubuntu using 'halt' or 'shutdown' command?
Thank you
I found this useful: https://linuxhandbook.com/system-has-not-been-booted-with-systemd/
In my case
# start docker using systemctl
sudo systemctl docker start
# returns:
#
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
The basic advice is:
# check if your system is using `systemd` or `sysvinit`
ps -p 1 -o comm=
If the command doesn't return systemd, and in my case, Ubuntu-20.04 on WSL, the command returned init, then use the command pattern
# start services using sysvinit
service docker start
This works for me.
Based on this: https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
systemd is now available in WSL Version 0.67.6 or higher.
To enable:
Open a command prompt:
# CHOOSE option A or B:
# A. check your version and ensure it is 0.67.6 or higher
wsl.exe --version
# B. run WSL update if the version is low
wsl.exe --update
Open a WSL prompt:
sudo nano /etc/wsl.conf
Add this to wsl.conf and save the file:
[boot]
systemd=true
Go back to the command prompt:
# warning: this will kill any shells/processes you have running!
wsl.exe --shutdown
First of all, Ubuntu installed via MS Store is using WSL (Windows Subsystem for Linux) Technology. It simply means there is no virtualization, Windows and Linux kernels are living side by side (the Linux kernel is not fully implemented yet).
So if you are trying to "shut down your Ubuntu", you would turn off the whole computer just like the Windows does. But in this case, WSL doesn't apparently have rights to do that.
In other words, you can look at your Ubuntu bash window just like any other terminal, like e.g. CMD or PowerShell.
When you start a program in the WSL (Ubuntu), you can see it also in Windows Task Manager - that's just a proof, that there is no virtualization.
Regarding docker:
If I'm not mistaken Windows 10 Home doesn't provide Hyper-V virtualization. It means you'll have to use a different one e.g. by using VirtualBox. In order to make it work, I can recommend you to follow this tutorial and especially for VirtualBox please check this answer here
Hope it helps :)

Mac:homebrew not installing all the Kafka scripts

I have installed kafka-0.8.2.2 using homebrew as mentioned in the below link
https://dtflaneur.wordpress.com/2015/10/05/installing-kafka-on-mac-osx/
i have configured only 1 broker..
Able to run zookeeper,kafka ,consumer,producer and publish messages using producer console and see messages in consumer console...
but when im trying to run below script im seeing this script is missing..
kafka-consumer-groups.sh
basically i want to see the
consumer group list
number of partitions available (would like to know the number of partitions present in broker)
and when i ran echo $KAFKA_HOME it gives empty i mean no value...
but when i ran brew install kafka
Warning: kafka-0.8.2.2 already installed
im concerened if kafka is installed properly..please suggest
able to see below scripts under usr/local/bin/
kafka-console-consumer.sh
kafka-console-producer.sh
kafka-consumer-offset-checker.sh
kafka-consumer-perf-test.sh
kafka-mirror-maker.sh
kafka-preferred-replica-election.sh
kafka-producer-perf-test.sh
kafka-reassign-partitions.sh
kafka-replay-log-producer.sh
kafka-replica-verification.sh
kafka-run-class.sh
kafka-server-start.sh
kafka-server-stop.sh
kafka-simple-consumer-shell.sh
kafka-topics.sh
not sure if any other scripts were than which i pointed out...
kafka-consumer-groups.sh is only available from 0.9.
Each topic (not broker) consists of partitions, so to check out partitions of a topic you can use:
/bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic your_topic_name
I don't know about brew installation of Kafka, since I'm using Docker, where you have a single command installation and you don't mess with your local file system. I wholeheartedly suggest that you try that (I can provide you with more details about that if you choose to go the Docker way).
After brew installing, you'll have some print out akin to this:
To restart kafka after an upgrade:
brew services restart kafka
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/kafka/bin/kafka-server-start /opt/homebrew/etc/kafka/server.properties
You can then run /opt/homebrew/opt/kafka/bin/kafka-consumer-groups

install redis as windows service

I've just installed redis on windows with MSOpenTech port. Everything is fine but the windows service. In order to run cmd, I need to create Redis command line arguments which I don't know how to achieve.
How can I solve this problem?
This is the instruction:
Running Redis as a Service
In order to better integrate with the Windows Services model, new
command line arguments have been introduced to Redis. These service
arguments require an elevated user context in order to connect to the
service control manager. If these commands are invoked from a
non-elevated context, Redis will attempt to create an elevated context
in which to execute these commands. This will cause a User Account
Control dialog to be displayed by Windows and may require
Administrative user credentials in order to proceed.
Installing the Service
--service-install
This must be the first argument on the redis-server command line.
Arguments after this are passed in the order they occur to Redis when
the service is launched. The service will be configured as Autostart
and will be launched as "NT AUTHORITY\NetworkService". Upon successful
installation a success message will be displayed and Redis will exit.
This command does not start the service.
For instance:
redis-server --service-install redis.windows.conf --loglevel verbose
Uninstalling the Service
--service-uninstall
In dir where you installed redis instead of
redis-server --service-install redis.windows.conf--loglevel verbose
do
redis-server --service-install redis.windows.conf --loglevel verbose
(i.e. Add a space before "--loglevel")
Similar to starting redis from command line, before installing the service you will need to specify the maxheap parameter. Open the redis.windows.conf file and find the line which comments out maxheap; specify a suitable size in bytes.
Then run
redis-server --service-install redis.windows.conf --loglevel verbose
You will need to manually start the service after you install it or just restart windows.
The simplest way is,
run command prompt as an administrator and than open redis directory and write
redis-server --service-install redis.windows.conf --loglevel verbose
the service will successfully installed.
For me as mentioned here, Redis doesn't start as windows service on Windows7
by installing the service with --service-name parameter runs the service magically without any issue.
The Microsoft Redis Open Tech project has been abandoned and no longer supported.
Memurai is a Windows port of Redis that derives from that Open Tech project (see here). It is actively maintained and supported.
Take a look.

Access JVM properties from command line

I have some JBoss 5.1.0 instances running on JDK1.6 on RHEL5. I would like to access heap/permgen/etc information from their VMs.
The JBoss configuration has not explicitly enabled JMX on the JVM for remote access with JConsole/JVisualVM.
I can access JBoss-related information through Twiddle, and, if I had a GUI on this machine, I would be able to access this information by running JConsole/JVisualVM (JDK 1.6 allows the connection of these clients after the app has been started, even without the com.sun.management options).
Is there a way to access this information without restarting these VMs?
The ways I can envisage doing it are:
Using Twiddle to access this information through JBoss' JMX console - if this is possible, what should I be passing in to find the information?
Using a command line client to connect to the running JDK in the same way that JConsole can. I am aware of cmdline-jmxclient but I don't know if it is capable of this.
The solution is to use jstat:
jstat -gccapacity -t 4994 5s
This line prints out the Garbage Collector capacity information, plus a timestamp for process 4994 every 5 seconds.
You need to be the correct user to gain access to the VM, so for me the above command had to be run sudo -u jboss jstat ....
There's lots more information on the documentation page.

Resources