Yum Repository

A problem happened when I try to install percona-xtrabackup-24, according to the official document, in order to sucessfully install Percona XtraBackup on CentOS prior to version 7, the libev package needs to be installed first. This libev package can be installed from the EPEL repositories.

MariaDB MaxScale

Intro

This blog is supposed to be used when someone else intends to have a simple MaxScale 2.4.7++ setup
considering a replication cluster. By replication cluster I mean one master and X slaves; in the
case of this blog, I’m using just one slave, but, you can add as many as you want.

There only 2 machines,

  • 192.168.1.105, worked as master.
  • 192.168.1.108, worked as slave, MaxScale also running on it.

MySQL find_in_set

MySQL FIND_IN_SET Function

MySQL FIND_IN_SET() function to return the position of a string in a comma-separated list of strings.

FIND_IN_SET(needle,haystack);

1
2
SELECT FIND_IN_SET('y','x,y,z'); -- 2
SELECT FIND_IN_SET('a',''); -- 0

New Load Balance Node Configuration

Working on 204, inet is 26

Prerequisite

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
sudo su
cat /etc/centos-release
uname -a # Linux Core Version
ulimit -a
lscpu
lsof -i # To display active TCP and UDP endpoints
ifconfig
nmcli device status #list network card
ls /etc/sysconfig/network-scripts/ #network card scripts
cat /etc/resolv.conf #DNS
cat /etc/sysconfig/network #Gateway
sestatus
sudo setenforce 0
which telnet
date
route #check route ip table

SELinux

Introduction

SELinux is a security mechanism built into the Linux kernel. Linux distributions such as CentOS, RHEL, and Fedora are equipped with SELinux by default.

SELinux improves server security by restricting and defining how a server processes requests and users interact with sockets, network ports, and essential directories.

For example, if an unauthorized user gains access, server access is restricted to a specified section, limiting the damage caused by the breach. SELinux can also obstruct the installation of software packages or terminate processes during regular use.

Start Linux Command in Background and Detach Process in Terminal

How to Start a Linux Process or Command in Background

If a process is already in execution, such as the tar command example below, simply press Ctrl+Z to stop it then enter the command bg to continue with its execution in the background as a job.

You can view all your background jobs by typing jobs. However, its stdin, stdout, stderr are still joined to the terminal.

Linux I/O

A command expects the first three file descriptors to be available. The first, fd 0 (standard input, stdin), is for reading. The other two (fd 1, stdout and fd 2, stderr) are for writing.

There is a stdin, stdout, and a stderr associated with each command. ls 2>&1 means temporarily connecting the stderr of the ls command to the same “resource” as the shell’s stdout.

By convention, a command reads its input from fd 0 (stdin), prints normal output to fd 1 (stdout), and error ouput to fd 2 (stderr). If one of those three fd’s is not open, you may encounter problems.

Redirection

Multiple output streams may be redirected to one file.

1
2
3
4
5
6
7
8
9
10
11
12
13
ls -yz >> command.log 2>&1
# Capture result of illegal options "yz" in file "command.log."
# Because stderr is redirected to the file,
#+ any error messages will also be there.

# Note, however, that the following does *not* give the same result.
ls -yz 2>&1 >> command.log
# Outputs an error message, but does not write to file.
# More precisely, the command output (in this case, null)
#+ writes to the file, but the error message goes only to stdout.

# If redirecting both stdout and stderr,
#+ the order of the commands makes a difference.