Hasitha's Blog is a blog that helps DevOps people do our regular tasks easily and perfectly.
Tuesday, April 16, 2019
How to remove ssh-agent process in redhat
When you log out, you want the ssh-agent process to be terminated automatically.
You can add below command in .bash_profile file
trap 'test -n "$SSH_AGENT_PID" && eval `/usr/bin/ssh-agent -k`' 0
If you need to remove existing processes,
for(( ; ; )); do kill $(ps -ef | grep ssh-agent | grep -v grep | grep -v grep | awk -F' ' '{print($2)}' | head -1 );echo "done"; done
Friday, April 5, 2019
Mysql Load Balancing with Nginx (Ubuntu)
Environment setup:
Mysql master server : 192.168.1.10
Mysql slave server : 192.168.1.12
Nginx server : 192.168.1.14
1. Add Nginx configurations
Add below configuration to nginx main configuration file (/etc/nginx/nginx.conf) just after the http block
stream {
upstream mysql_cluster {
server 192.168.1.10:3306; # node1
server 192.168.1.12:3306 backup; # node2
}
server {
listen 3306;
proxy_pass mysql_cluster;
}
}
2. Open 3306 port in Nginx server
Since we are using 3306 port, we need to use SELinux and open port privileges
Try below command in Nginx server
sudo semanage port -l | grep http_port_tcheck port 3306 is there, if not we can add it by using below command
sudo semanage port -a -t http_port_t -p tcp 33063. Enable firewall
If you are using CentOS, you may use below command to enable firewall rules in Nginx server
firewall-cmd --zone=public --add-port=3306/tcp --permanentfirewall-cmd --reload
Subscribe to:
Posts (Atom)
File Sharing using NFS in GKE Cluster
File Sharing using NFS in GKE Cluster There was a requirement to create common file sharing location which should be accessible by specific...
-
Once you generate SSH key pair to connect to a server using putty and you are going to import it into Xshell you will be noticed below notif...
-
You can use below shell script to simulate a pre-defined load on an API. #!/bin/bash ##########################################...
-
Here is a simple HTTP listener using Python BaseHTTPRequestHandler This Application will, listen to port 8000 on localhost respond to...