How to Configure MySQL Master-Slave Replication on CentOS 7. MySQL replication is a process that allows you to automatically copy data from one database server to one or more servers. In this tutorial we will explain how to setup a MySQL Master/Slave replication with one master and one slave server on CentOS 7. $ sudo aptitude install netcat. If you have Fedora or a Fedora based system such as CentOS, do: $ sudo yum install netcat. If you have Slackware, FreeBSD, NetBSD, Solaris, or Mac, download the nc sources and do: $ tar -zxf nc-version.tar.gz $ cd nc-version $./configure && sudo make install Another way to do this on a Mac is if you have MacPorts.
Netcat the Multi-purpose Networking ToolLinux netcat - nc command examples netcat - nc - UtilityThe netcat utility or nc is often referred to as the Swiss Army Knife for working with TCP/IP networks. This tool is very popular amongst System Administrators and Network Administrators because of its wide range of capabilities.
The netcat utility is used for almost anything under the sun involving TCP, UDP, or UNIX-domain sockets. Netcat can open TCP connections, send UDP packets of data, listen on arbitrary TCP and UDP ports, carry out port scanning, transfer data from one server to another. In the following examples I will be using an Ubuntu 14.04 LTS system and a CentOS 6.5 system.
Installing netcat on UbuntuIf you need to install netcat, you can use the following commands:$ sudo apt-get update$ sudo apt-get install netcatNote: In Ubuntu 14.04 LTS netcat came pre installed. (No need to install)Installing netcat on RHEL - CentOSTo install netcat on a RHEL/CentOS system (64bit), simply issue the following command: yum install nc.x8664root@centos-65 # yum install nc.x8664Examples of netcat networking utilityIn the following examples we will take a quick look at some of the popular uses of netcat.Checking for an Open PortIn this example we will use netcat to interrogate a port to see if it is open. We will use the netcat command in conjunction with the ' -v' and ' -n' flags. The '-v' flag specifies that we would like verbose output (more detailed). The '-n' option specifies that we do not wish to use DNS or service lookups on any addresses, hostnames or ports.Example Command: nc -vn 192.168.0.17 22In the above example we have specified the IP address of a RHEL (Red Hat Enterprise Linux 6.3) server followed by the port we wish to interrogate. In this example we are looking at port 22 (normally used for ssh).john@ubuntu01-pc:$ nc -vn 192.168.0.17 22Connection to 192.168.0.17 22 port tcp/. succeeded!SSH-2.0-OpenSSH5.3As we can see from the output port 22 is open for connections.
If we now check for a port which is closed, you will see the difference in the output from the command:john@ubuntu01-pc:$ nc -vn 192.168.0.17 2000nc: connect to 192.168.0.17 port 2000 (tcp) failed: No route to hostnetcat as a Port ScannerAnother popular use of the netcat command is to use it as a port scanner. In this example we will be using the flags ' -w' and ' -z' in addition to the '-v' and '-n' flags. The '-w' flag is used to specify a timeout limit. By default, netcat will listen forever, however, in this example we are going to use a more realistic value of '1' second.
![Install Install](/uploads/1/2/5/5/125512762/376428443.png)
The '-z' flag specifies that netcat should merely scan for listening daemons without sending any data. We will also specify a range of ports to check.
Netcat operates in 2 modes. Server mode. Client modeServer mode: In the server, mode netcat listens to incoming connections depending on various parameters that may have been passed to the utility.The below syntax indicates how you would typically use netcat in the server mode: nc -l -p port options hostname portClient mode: In the client, mode netcat initiates a TCP/UDP connection to the same or different machine.The below syntax depicts how you would typically use netcat in the client mode: nc -options hostname ports portsWe will be covering both methods in depth in our examples. Typical uses of the Linux netcat tool. Chat server.
![Install Install](http://techantidote.com/wp-content/uploads/2016/06/chat.png)
Port scanner. File transfer. Information fetchingChat server: We can use netcat to transfer simple text messages between two system forming a rather minimal and straightforward instant messaging interface.Port scanner: Netcat can be used to scan open. Its port scanning capabilities are somewhat trivial, and we’d strongly recommend using NMAP in this regard.File transfer: it allows file transfers between servers without needing to resort to or or.Information fetching: Netcat can be used to establish a socket to a specific port on the destination system to identify specific information or weaknesses in the system. This is similar to. Netcat comes pre-installed in both Red Hat and Debian based distributions.We’ll now verify that the presence of netcat on a centos 6 and an Ubuntu 16.04 machine. Root@linuxnix:# nc This is nc from the netcat-openbsd package.
An alternative nc is availablein the netcat-traditional package. Usage: nc -46bCDdhjklnrStUuvZz -I length -i interval -O length-P proxyusername -p sourceport -q seconds -s source -T toskeyword -V rtable -w timeout -X proxyprotocol-x proxyaddress:port destination portIn contrast to the above, this is the output produced by running netcat without any options on my centos system. root@linuxnix # nc usage: nc -46DdhklnrStUuvzC -i interval -p sourceport -s sourceipaddress -T ToS -w timeout -X proxyversion -x proxyaddress:port hostname portsNow we will go through some examples to understand how we can use netcat according to our requirements. Getting help from nc commandUse nc command with the -h option to obtain a short description about some of the options that are available for use with netcat.