How to install qryn

STEP 1: Install Clickhouse

Please use this link to install the clickhouse database.


STEP 2: Install Node.js

Please use this link to install Node.js on your system.


STEP 3: Install qryn

Install qryn using npm

npm install -g qryn


now start the service using the following command

CLICKHOUSE_SERVER="my.clickhouse.server" \
CLICKHOUSE_AUTH="default:password" \
CLICKHOUSE_DB="qryn" \
qryn


for more params / environment variables read the documentation.


To start qryn as a service, first install pm2

npm install -g pm2


and start the service as follows

CLICKHOUSE_SERVER="my.clickhouse.server" \
CLICKHOUSE_AUTH="default:password" \
CLICKHOUSE_DB="qryn" \
pm2 start qryn --watch
pm2 save
pm2 startup


to remove from the startup

pm2 unstartup

Verify Installation

qryn will start listening on port 3100.


try accessing qryn-view from the browser

http://qryn.hbvoice.local:3100

image


Don't forget to configure grafana-agent / vector to send logs to qryn.

Enjoy 😉



Caution

Old methods (Deprecated)


go to the directory

cd /usr/local/

git clone https://github.com/metrico/qryn && cd qryn
npm install


Create a Unit file

vim /etc/systemd/system/qryn.service


Copy the following and add inqryn.service add ENVs as required.

[Unit]
Description=Captures packets from wire and sends them to Hepic
After=network.target

[Service]
WorkingDirectory=/usr/local/qryn/
Environment="CLICKHOUSE_SERVER=127.0.0.1"
Environment="CLICKHOUSE_AUTH=default:clickpass"
Environment="CLICKHOUSE_DB=qryn"
ExecStart=node /usr/local/qryn/qryn_node.js
ExecStop=/bin/kill ${MAINPID}
Restart=on-failure
RestartSec=10s
Type=simple

[Install]
WantedBy=multi-user.target


start qryn

systemctl start qryn


Check status

systemctl status qryn
● qryn.service - Captures packets from wire and sends them to Hepic
     Loaded: loaded (/etc/systemd/system/qryn.service; disabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-12-27 19:41:17 PKT; 4s ago
   Main PID: 1186 (node)
      Tasks: 12 (limit: 2323)
     Memory: 172.7M
        CPU: 1.976s
     CGroup: /system.slice/qryn.service
             └─1186 node /usr/local/qryn/qryn_node.js

Dec 27 19:41:20 qryn-server node[1186]: {"level":30,"time":1703688080795,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"Initializing DB... qryn"}
Dec 27 19:41:20 qryn-server node[1186]: {"level":30,"time":1703688080390,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"xxh ready"}
Dec 27 19:41:20 qryn-server node[1186]: {"level":30,"time":1703688080860,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"xxh ready"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081019,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"Checking clickhouse capabilities"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081039,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"LIVE VIEW: unsupported"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081044,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"checking old samples support: samples_v2"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081052,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"checking old samples support: samples"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081374,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"Server listening at http://0.0.0.0:3100"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081375,"pid":1186,"hostname":"qryn-server","name":"qryn","msg":"Qryn API up"}
Dec 27 19:41:21 qryn-server node[1186]: {"level":30,"time":1703688081375,"pid":1186,"hostname":"qryn-server","name":"qr

No comments:

Post a Comment

How to store IOT devices data Using QRYN

Configuring your own MQTT broker with a database offers significant cost advantages over cloud IoT platforms like AWS or Azure. You eliminat...