I have a node.js app to be running with rabbitmq and mysql.
After setting everything up, when I do npm start
I have given the user administrator tag and permissions as
rabbitmqctl set_permissions RABBIT_USERNAME "." "." ".*"
It shows this error :
> node app.js
13:43
Started database log (Mon Jan 29 2018 13:43:42 GMT+0530 (IST))
13:43
Started mailer log (Mon Jan 29 2018 13:43:44 GMT+0530 (IST))
13:43
Started messaging log (Mon Jan 29 2018 13:43:44 GMT+0530 (IST))
13:43
Started messaging log (Mon Jan 29 2018 13:43:44 GMT+0530 (IST))
13:43
Started database log (Mon Jan 29 2018 13:43:44 GMT+0530 (IST))
13:43
Started socket log (Mon Jan 29 2018 13:43:44 GMT+0530 (IST))
13:43 messaging:3000 is listening..
13:43 DB connected (7)
13:43 DB connected (6)
13:43 Error:
Expected ConnectionOpenOk; got <ConnectionClose channel:0>
Error: Expected ConnectionOpenOk; got <ConnectionClose channel:0>
at /PATH/node_modules/amqplib/lib/connection.js:167:14
at /PATH/node_modules/amqplib/lib/connection.js:159:12
at Socket.recv (/PATH/node_modules/amqplib/lib/connection.js:497:12)
at Object.onceWrapper (events.js:255:19)
at Socket.emit (events.js:160:13)
at emitReadable_ (_stream_readable.js:520:10)
at emitReadable (_stream_readable.js:514:7)
at addChunk (_stream_readable.js:280:7)
at readableAddChunk (_stream_readable.js:256:11)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onread (net.js:599:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! messaging# start: `node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the messaging# start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mishal23/.npm/_logs/2018-01-29T08_13_45_095Z-debug.log
There is no enough context on how this happened so I'm making a few assumptions:
RabbitMQ is not installed locally and it is installed on some server.
You're using amqplib for the connection. (Not an assumption)
You haven't created any Virtual Hosts.
Setting Up
So the first thing you need to do is to create a user if you haven't already.
sudo rabbitmqctl add_user admin password
sudo rabbitmqctl set_user_tags admin administrator
Run this command if you haven't enabled the Management Dashboard
sudo rabbitmq-plugins enable rabbitmq_management
By default, it runs on port 15672. So don't forget to open that port. And you can access this dashboard using your.server.ip.address:15672.
Now in this Management Dashboard, go to the Admin tab and on the right side, you'll see a link to Virtual Hosts.
There will be one virtual host named / and user guest (that you cannot access without localhost). Now create a new virtual host and check if it has the same user as you just created a few moments back (admin in this case).
Connecting to the RabbitMQ server
Use the string below to connect to the server instead of amqp://localhost
amqp://admin:password#your.server.ip.address/vhost_name
You can use this example (or any other examples) for the rest of the things...
I hope this helps!
Go to the rabbitmq dashboard > click admin menu > select your user from which you want to connect > click set permission button > restart server
In my case, the issue was related to heartbeat. You have to pass the heartbeat as a parameter to your connection URL:
amqps://user:password#domain/vhost_name?heartbeat=30
Related
I've installed qemu virt-manager libvirt on Linux Mint 20, I have a AMD FX(tm)-4300 Quad-Core Processor with AMD-V enabled in the bios, restarted a lot but virt-manager(Virtual Machine Manager) is saying:
Unable to connect to libvirt lxc:///.
Failed to connect socket to '/var/run/libvirt/virtlxcd-sock': No such file or directory
Libvirt URI is: lxc:///
I am running this locally. The file/socket does not exist, but there is a "libvirt-sock" (and other files) in that folder.
The service is running, but reporting the same error:
libvirtd.service - Virtualization daemon
Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-09-01 10:11:27 BST; 12min ago
TriggeredBy: ● libvirtd.socket
● libvirtd-ro.socket
● libvirtd-admin.socket
Docs: man:libvirtd(8)
https://libvirt.org
Main PID: 731 (libvirtd)
Tasks: 19 (limit: 32768)
Memory: 34.2M
CGroup: /system.slice/libvirtd.service
├─ 731 /usr/sbin/libvirtd
├─1041 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>
└─1042 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt>
Sep 01 10:11:29 mainlinux dnsmasq[1041]: read /var/lib/libvirt/dnsmasq/default.addnhosts - 0 addresses
Sep 01 10:11:29 mainlinux dnsmasq-dhcp[1041]: read /var/lib/libvirt/dnsmasq/default.hostsfile
Sep 01 10:12:35 mainlinux libvirtd[731]: libvirt version: 6.0.0, package: 0ubuntu8.3 (Marc Deslauriers <marc.deslauriers#ubuntu.com> Thu, 30 >
Sep 01 10:12:35 mainlinux libvirtd[731]: hostname: mainlinux
Sep 01 10:12:35 mainlinux libvirtd[731]: Failed to connect socket to '/var/run/libvirt/virtlxcd-sock': No such file or directory
Sep 01 10:12:35 mainlinux libvirtd[731]: End of file while reading data: Input/output error
I'm updated my kernel to 5.8.5-generic, but other than that, running Mint 20 (based on Ubuntu focal). Anyone know how to fix this, or display a log as to why virtlxcd-sock is not being created?
Also tried sudo chmod 777 on the libvirt subfolder and restarted libvirtd, same error.
Been googling for hours, finally found the one that worked for me, seems like installing libvirt and lxc does not install this package:
sudo apt install libvirt-daemon-driver-lxc
sudo systemctl restart libvirtd
I am trying to start saned using systemd on Fedora Server 31 arm7hl.
My systemd units look like:
saned.socket:
[Unit]
Description=saned incoming socket
PartOf=saned.service
[Socket]
ListenStream=6566
Accept=yes
MaxConnections=5
[Install]
WantedBy=sockets.target
saned.service:
[Unit]
Description=Scanner Service
Requires=saned.socket
[Service]
ExecStart=/usr/sbin/saned
User=saned
Group=saned
StandardInput=socket
#StandardOutput=syslog
StandardError=syslog
Environment=SANE_CONFIG_DIR=/etc/sane.d
Environment=SANE_DEBUG_DLL=128 SANE_DEBUG_NET=128
[Install]
Also=saned.socket
but when I want to start saned.service, I always get
Mar 14 11:00:32 host systemd[1]: saned.service: Got no socket.
Mar 14 11:00:32 host systemd[1]: saned.service: Failed to run 'start' task: Invalid argument
Mar 14 11:00:32 host systemd[1]: saned.service: Failed with result 'resources'.
Any ideas what could be wrong?
Best regards,
rforberger
Ok, I solved it myself.
I followed the instructions of the man page of saned, where an example of the systemd units is described.
Now my saned unit is still in dead state (systemd) but I can scan remotely anyway....
First thing, I am not sure if this is better here or on ask ubuntu (ubuntu did not have a 'gunicorn' tag so I think i'm in the right place). If it is not appropriate here just drop it in the comments and I'll close it.
I am following a digitalocean tutorial on deployment(https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04).I am up to gunicorn set up. I'm at my wits end trying to get this gunicorn to work, so I have come here. Anything in quotes is the name of the current section in the article. I got up to "Checking for the Gunicorn Socket File" and "check for the existence of the gunicorn.sock file within the /run directory:" before failure.
Check for socket file:
sudo systemctl status gunicorn.socket returns
Failed to dump process list, ignoring: No such file or directory
● gunicorn.socket - gunicorn socket
Loaded: loaded (/etc/systemd/system/gunicorn.socket; enabled; vendor pres
Active: active (listening) since Fri 2020-02-21 21:34:06 UTC; 1min 8s ago
Listen: /run/gunicorn.sock (Stream)
CGroup: /system.slice/gunicorn.socket
Check for existence of gunicorn.sock:
file /run/gunicorn.sock
output: /run/gunicorn.sock: socket
Upon "Testing socket activation", it fails:
sudo systemctl status gunicorn
output:
● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service;
Active: failed (Result: exit-code) since Fri 2020-02-
Main PID: 15708 (code=exited, status=217/USER)
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: S
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[15708
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[15708
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: g
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: g
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: g
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: g
Feb 21 21:32:39 ubuntu-s-1vcpu-1gb-nyc3-01 systemd[1]: F
lines 1-13/13 (END)
It says to test socket activation, do the following:
curl --unix-socket /run/gunicorn.sock localhost
output(says I should see HTML):
curl: (56) Recv failure: Connection reset by peer
Not sure if I provided enough info. Below I will include my gunicorn.socket and gunicorn.service files as well as the layout of directories on my server.
gunicorn.socket:
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/run/gunicorn.sock
[Install]
WantedBy=sockets.target
gunicorn.service:
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=justin
Group=www-data
WorkingDirectory=/home/justin/project
ExecStart=/home/justin/project/env/bin/gunicorn \
--access-logfile - \
--workers 3 \
--bind unix:/run/gunicorn.sock \
jobzumo.wsgi:application
[Install]
WantedBy=multi-user.target
Layout of server/project:
home/justin/project/
This project/ folder contains env(env/bin/gunicorn does exist), jobzumo(django project), manage.py and static.
The only thing I am thinking is that I may have created these gunicorn files while using root and now I am trying to modify them using the user justin? Not really sure what is going on here. If I did not provide enough info or if you need me to run any type of debug commands please let me know. Thanks for any help.
I had the exact same propblem following this tutorial. OP's answer did not help in my case but I found a solution here. Maybe it helps others stubmling over this.
Many thanks to RussellMolimock for the following comment, which I found there!
"Go back into your virtualenv with source
[your_project_env]/bin/activate and enter which gunicorn That will
return the path to your gunicorn exectuable.
Paste that into the path section of the ‘ExecStart’ value inside the
’/etc/systemd/system/gunicorn.service’ file, and run the ‘sudo
systemctl daemon-reload’ and 'sudo systemctl restart gunicorn’
commands to restart your daemon and try curling again with curl
–unix-socket /run/gunicorn.sock localhost
I hope this helps!"
I had to run the following two commands:
sudo ufw delete allow 8000
sudo ufw allow 'Nginx Full'
and now everything is working. Apparently this opens my firewall up to port 80. Not sure why as I don't specify port 80 there, but it is working.
I faced this error because Gunicorn was not able to read the environment variables. This helped me in defining the environment variables for Gunicorn.
I deleted the whole project folder in Ubuntu (home/user/project) and restarted from the beginning, and it worked. I have tried multiple solutions on the Internet, restarting the daemon and changing the path of gunicorn, all fail.
Here is my startup script:
#! /bin/sh
sudo apt-get update
sudo apt-get install mysql-client
wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy
chmod +x cloud_sql_proxy
sudo mkdir /cloudsql; sudo chmod 777 /cloudsql
./cloud_sql_proxy -dir=/cloudsql --instances=a:us-east4:b &
Here is the error I get:
Feb 19 22:12:38 instance-group-1-th2f startup-script: INFO startup-
script: 2019/02/19 22:12:38 errors parsing config:
Feb 19 22:12:38 instance-group-1-th2f startup-script: INFO startup-script: #011Get https://www.googleapis.com/sql/v1beta4/projects/a/instances/b?alt=json&prettyPrint=false: dial tcp: lookup www.googleapis.com on [::1]:53: read udp [::1]:52058->[::1]:53: read: connection refused
Feb 19 22:12:38 instance-group-1-th2f startup-script: INFO startup-script: 2019/02/19 22:12:38 Ready for new connections
If I open the instance manually and run the following, it will work:
./cloud_sql_proxy -dir=/cloudsql -instances=a:us-east4:b &
I am guessing that it is an authentication problem, but based on this:
Note: If your Compute Engine instance has either the Full API access
or Cloud SQL API scope, you can skip this step; you do not need to
provide a certificate file when you start the proxy.
It shouldn't have any problems since mine has a Full API access
I have a second gen instance and the Cloud SQL Admin API is enabled.
dial tcp: lookup www.googleapis.com on [::1]:53: read udp [::1]:52058->[::1]:53: read: connection refused
It doesn't look like your issue is authenticated related, but instead you are unable to either lookup or reach www.googleapis.com. Do you have a firewall that might be blocking the outgoing connection?
At some point my logstash forwarder used to work properly but at some point fail to start with this error message
Failed unmarshalling json: invalid character ']' looking for beginning of value logstash
This message appears only if i run forwarder with this command:
$ /opt/logstash-forwarder/bin/logstash-forwarder -config="/etc/logstash-forwarder"
If i run it as a service it fails without any error message, if i restart the service getting this
Restarting log shipper logstash-forwarder
start-stop-daemon: warning: failed to kill PID: No such process
...done.
The first time stopped forwarder working i found in syslog this message:
connection from UDP: [54.194.184.218]:63707->[10.38.143.181] Nov 21
12:41:38 logstash-forwarder[PID]: 2014/11/21 12:41:38.692517 Read
error looking for ack: EOF Nov 21 12:41:38 logstash-forwarder[PID]:
2014/11/21 12:41:38.692592 Setting trusted CA from file:
/etc/pki/tls/certs/logstash-forwarder.crt Nov 21 12:41:38
logstash-forwarder[PID]: 2014/11/21 12:41:38.692827 Connecting to
X.X.X.X:5000 (X.X.X.X) Nov 21 12:41:38 logstash-forwarder[PID]:
2014/11/21 12:41:38.694128 Failure connecting to X.X.X.X: dial tcp
X.X.X.X:5000: connection refused
At server side logstash and ES cluster seems to work fine..
I found many similar problems with mine but not any solution.