Previously, I had a django application/database on the same server.
Now I have made one server with application, one server with database(Debian 11; Postgresql 12.9 (Install via Homebrew))
Problem: after a few hours there are problems with connecting to the database...
postgres log:
2022-01-24 23:27:00.315 UTC [9982] LOG: received smart shutdown request
2022-01-24 23:27:00.323 UTC [9982] LOG: background worker "logical replication launcher" (PID 9996) exited with exit code 1
2022-01-24 23:27:00.324 UTC [9991] LOG: shutting down
2022-01-24 23:27:00.344 UTC [9982] LOG: database system is shut down
/var/log/syslog:
Jan 24 23:27:00 d systemd[1]: Stopping User Manager for UID 1000...
Jan 24 23:27:00 d systemd[8909]: Stopped target Main User Target.
Jan 24 23:27:00 d systemd[8909]: Stopping D-Bus User Message Bus...
Jan 24 23:27:00 d systemd[8909]: Stopping Homebrew generated unit for postgresql#12...
Jan 24 23:27:00 d systemd[8909]: dbus.service: Succeeded.
Jan 24 23:27:00 d systemd[8909]: Stopped D-Bus User Message Bus.
Jan 24 23:27:00 d systemd[8909]: homebrew.postgresql#12.service: Succeeded.
Jan 24 23:27:00 d systemd[8909]: Stopped Homebrew generated unit for postgresql#12.
Jan 24 23:27:00 d systemd[8909]: homebrew.postgresql#12.service: Consumed 1min 22.614s CPU time.
Jan 24 23:27:00 d systemd[8909]: Removed slice app-homebrew.postgresql.slice.
Jan 24 23:27:00 d systemd[8909]: app-homebrew.postgresql.slice: Consumed 1min 22.614s CPU time.
Jan 24 23:27:00 d systemd[8909]: Stopped target Basic System.
...
I connect to server via terminal from my local computer. I see only my sessions(loginctl list-sessions), if I kill it, then postgresql will fall again.
I need to create a user that will be permanently active? How to do it right?
Related
I tried to install and start the Tomcat on my AWS EC2 instance.
However, I failed to run tomcat server after installed it.
I followed the following article for that
https://blog.devops4me.com/aws-tutorial-how-to-install-tomcat-in-aws-ec2-install/
And after finished step 6, and reloaded tomcat server, I tried to restart tomcat service like step 7. However, my terminal showed as below:
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service: control process exited, code=exited status=203
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Failed to start Tomcat Server.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:07 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
Feb 14 20:17:10 ip-172-31-54-104.ec2.internal systemd[1]: [/etc/systemd/system/tomcat.service:22] Missing '='.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service holdoff time over, scheduling restart.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed to schedule restart job: Unit is not loaded properly: Bad message.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: Unit tomcat.service entered failed state.
Feb 14 20:17:22 ip-172-31-54-104.ec2.internal systemd[1]: tomcat.service failed.
I don't really understand how this work, and tried to search error on internet, but still doesn't have any clue of how to solve this problem, if anyone can give me a hint, that would be great, thank you!
I'm trying to install ssl certificate on aws ec2(Amazon Linux2). Apache can start properly until I configure ssl following "Step 1: Enable TLS on the server" in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-amazon-linux-ami.html
After I make those changes, apache even can not start:
Job for httpd.service failed because the control process exited with error code
I got the following log by typing "journalctl -xe":
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-26.scope has begun starting up.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal CROND[10239]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Removed slice User Slice of root.
-- Subject: Unit user-0.slice has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has finished shutting down.
Jan 27 04:30:01 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Stopping User Slice of root.
-- Subject: Unit user-0.slice has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit user-0.slice has begun shutting down.
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Received disconnect from 221.181.185.135 port 21146:11: [preauth]
Jan 27 04:30:47 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10245]: Disconnected from 221.181.185.135 port 21146 [preauth]
Jan 27 04:31:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 120170ms.
Jan 27 04:33:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 119290ms.
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Received disconnect from 218.93.208.150 port 29589:11: [preauth]
Jan 27 04:34:55 ip-172-31-18-58.ap-southeast-2.compute.internal sshd[10251]: Disconnected from 218.93.208.150 port 29589 [preauth]
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: ec2-user : TTY=pts/2 ; PWD=/etc/pki/tls/certs ; USER=root ; COMMAND=/bin/systemct
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session opened for user root by ec2-user(uid=0)
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: Unit httpd.service entered failed state.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal systemd[1]: httpd.service failed.
Jan 27 04:35:17 ip-172-31-18-58.ap-southeast-2.compute.internal sudo[10253]: pam_unix(sudo:session): session closed for user root
Jan 27 04:35:22 ip-172-31-18-58.ap-southeast-2.compute.internal dhclient[2893]: XMT: Solicit on eth0, interval 130780ms.
I get stuck here for a long time. Anyone can help me please? Thank you in advance.
Currently learning how to config an openVPN server on an AWS Linux server as a bit of a self-taught exercise. I've managed to set everything up to trying to connect to it via the OpenVPN client GUI, but it's not working. The error message in the log below:
Enter Management Password:
Mon May 18 14:59:57 2020 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Mon May 18 14:59:57 2020 Need hold release from management interface, waiting...
Mon May 18 14:59:57 2020 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'state on'
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'log all on'
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'echo all on'
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'bytecount 5'
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'hold off'
Mon May 18 14:59:57 2020 MANAGEMENT: CMD 'hold release'
Mon May 18 14:59:57 2020 WARNING: --ns-cert-type is DEPRECATED. Use --remote-cert-tls instead.
Mon May 18 14:59:57 2020 OpenSSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
Mon May 18 14:59:57 2020 Cannot load private key file client.key
Mon May 18 14:59:57 2020 SIGUSR1[soft,private-key-password-failure] received, process restarting
Mon May 18 14:59:57 2020 MANAGEMENT: >STATE:1589810397,RECONNECTING,private-key-password-failure,,,,,
Mon May 18 14:59:57 2020 Restart pause, 5 second(s)
Here's the configs I have for server and client:
client
dev tun
proto udp
remote [MY AWS IP GOES HERE] 1194
ca ca.crt
cert client.crt
key client.key
tls-version-min 1.2
tls-cipher TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256:TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-256-CBC-SHA256
cipher AES-256-CBC
auth SHA512
resolv-retry infinite
auth-retry none
nobind
persist-key
persist-tun
ns-cert-type server
comp-lzo
verb 3
tls-client
tls-auth pfs.key
Server
port 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/pki/ca.crt
cert /etc/openvpn/easy-rsa/pki/issued/server.crt
key /etc/openvpn/easy-rsa/pki/private/server.key
dh /etc/openvpn/easy-rsa/pki/dh.pem
cipher AES-256-CBC
auth SHA512
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
persist-key
persist-tun
status openvpn-status.log
log-append openvpn.log
verb 3
tls-server
tls-auth /etc/openvpn/pfs.key
I am trying to stop Clamav service in Linux, but I am not able to do that.
I have installed Clamav in a seperate directory.
When running below command:
$ systemctl stop clamav-daemon
I get this error message:
Warning: Stopping clamav-daemon.service, but it can still be activated by:
clamav-daemon.socket
When running:
$ systemctl status clamav-daemon
I get:
clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/usr/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2020-04-29 13:23:33 IST; 7s ago
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Main PID: 32213 (clamd)
Tasks: 1
CGroup: /system.slice/clamav-daemon.service
└─32213 /usr/local/sbin/clamd --foreground=true
Any help will be appreciated. Thanks.
When you are logged in as a normal user which can be understood by seeing the $ sign in your command, clamav won't stop. You need to perform the following command.
It will stop clamav for only logged-in session
$ sudo systemctl stop clamav-daemon
To see the status
$ sudo systemctl status clamav-daemon
It will return:
● clamav-daemon.service - Clam AntiVirus userspace daemon
Loaded: loaded (/lib/systemd/system/clamav-daemon.service; disabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/clamav-daemon.service.d
└─extend.conf
Active: inactive (dead)
Docs: man:clamd(8)
man:clamd.conf(5)
https://www.clamav.net/documents/
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HTML support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> XMLDOCS support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> HWP3 support enabled.
Aug 20 08:58:53 machine clamd[808]: Thu Aug 20 08:58:53 2020 -> Self checking every 3600 seconds.
Aug 20 09:58:53 machine clamd[808]: Thu Aug 20 09:58:53 2020 -> SelfCheck: Database status OK.
Aug 20 10:57:51 machine systemd[1]: Stopping Clam AntiVirus userspace daemon...
Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> --- Stopped at Thu Aug 20 10:57:52 >
Aug 20 10:57:52 machine clamd[808]: Thu Aug 20 10:57:52 2020 -> Socket file removed.
Aug 20 10:57:52 machine systemd[1]: clamav-daemon.service: Succeeded.
Aug 20 10:57:52 machine systemd[1]: Stopped Clam AntiVirus userspace daemon.
If you have created symbolic link of clamav daemon to start the program automatically when pc boot then you need to remove that link so that clamav shouldn't start automatically
$ sudo systemctl disable clamav-daemon
I am using rrdtool-1.4.7-1 version of rrd tool.
In normal case, If all RRD data has been flushed then "clean shutdown; all RRDs flushed message" displays in syslog logs.
Below message will show when shutdown is performed.
Mar 21 10:36:28 rrdcached[52232]: caught SIGTERM
Mar 21 10:36:28 rrdcached[52232]: starting shutdown
Mar 21 10:36:29 rrdcached[52232]: clean shutdown; all RRDs flushed
Mar 21 10:36:29 rrdcached[52232]: removing journals
Mar 21 10:36:29 rrdcached[52232]: goodbye
but in problematic case, below message display and failed to stop rrd cached.
Mar 21 10:36:28 rrdcached[52232]: caught SIGTERM
Mar 21 10:36:28 rrdcached[52232]: starting shutdown
I have also checked on top logs and flushing is in progress on directory.
Please let me know in which case rrd cached daemon will fail to stop?