MySQL-Master-Master-Replication

Master-Master replication, or “Multi-Master” replication has two or more hosts that are both master and slave to each other. We use Master-Master replication for high availability. If we make changes to one MySQL host, then the changes are replicated to the other host, and vice versa. We can also layer on top an IP virtual… Continue reading MySQL-Master-Master-Replication

Published
Categorized as blogging Tagged

Java process monitoring with visual VM

Start up Jstatd on the server /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64-debug/bin/jstatd -J-Djava.security.policy=/home/admin/.jstatd.all.policy& cat /home/admin/.jstatd.all.policy grant codebase “file:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64-debug/lib/tools.jar” { permission java.security.AllPermission; }; Install and start visualvm on your local https://visualvm.github.io/download.html Start the tunnel to the remote server ssh -v -D 9696 @ Setup SOCKS proxy on the VISUALVM app. localhost 9696 Add remote host using the remote IP.

Published
Categorized as blogging

jvmtop

How do you monitor memory usage of java threads. It helps you track the internal memory usage running java processes Use opensource jvmtop – https://github.com/patric-r/jvmtop Installation is simple Download https://github.com/patric-r/jvmtop/releases/download/0.8.0/jvmtop-0.8.0.tar.gz Untar tar -xvz jvmtop-0.8.0.tar.gz set JAVA_HOME in the script – tip: Look for tools.jar in the lib folder export JAVA_HOME=/home/admin/java/jdk1.6.0_31/ Start sh jvmtop.sh      … Continue reading jvmtop

Published
Categorized as blogging

Disk usage of mysql DB

To calculate the disk usage of your DBs in mysql   you can use “DU” which is less reliable and if you hosting on cloud database services, you cannot use this. du -sh /var/lib/mysql/database OR use the below query.   select table_schema, sum((data_length+index_length)/1024/1024) AS MB from information_schema.tables group by 1;

Published
Categorized as Linux

Port forwarding using ssh

  How to use port forwarding when you are behind a firewall. to access a service running locally on the remote server. To setup a proxy ssh -L 3128:localhost:80 <username>@YOURREMOTESERVER REMOTE Port forwarding Below example could be used to access RDP behind a firewall, but accessible from YOURREMOTESERVER ssh -L 3389:YOURREMOTE_SERVER_WHERESERIVERUN_IP:3389 <username>@YOURREMOTESERVER -N 3389 – RDP port… Continue reading Port forwarding using ssh

compressing a pdf to a lower size

Use Ghost Script from commandline gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/screen -dCompatibilityLevel=1.6 -sOutputFile=pdfoutsmallfile.pdf pdfinputlargefile.pdf -dNOPAUSE – disable the interactive prompting pdfwrite – create pdf files -dCompatibilityLevel=1.6 – compatibility with each versions of adobe. Use 1.3,1.4,1.6,1.7 -sOutputFile – name of the output file.

Port check script

#!/bin/bash RED=’\033[0;31m’ GREEN=”\033[0;32m” NC=’\033[0m’ # No Color function checkport { if nc -zv -w30 $1 $2 <<< ” &> /dev/null then echo “${GREEN}[O]${NC} $1:$2” else echo “${RED}[C]${NC} $1:$2” fi } printf “server list:”; read server printf “ports list[enter for default]:” read ports_to_check if [[ $ports_to_check = “” ]]; then echo “using default port list”; ports_to_check=”22… Continue reading Port check script

Add a file to SVN ignore list

  Check the status svn status –no-ignore <svn directory> Add file to ignore list svn status –no-ignore svn propset svn:ignore <file to ignore >  <svn directory>  

Published
Categorized as Linux

Create a md5 hash password

Here are the steps to create an MD5 hash password To use in linux shadow file or when you want to update the password somewhere You will need “mkpasswd” If your server seem to be missing the mkpasswd command, install it using yum. yum install expect Create the password and update for the user in… Continue reading Create a md5 hash password

Published
Categorized as blogging