Jumat, 30 Agustus 2019

How to install Percona MySql Server 8 on Linux Centos 7

  Tidak ada komentar
How to install Percona MySql Server 8 on Centos 7
[root@localhost ~]# yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
Loaded plugins: fastestmirror
percona-release-latest.noarch.rpm                                                                              |  17 kB  00:00:00
Examining /var/tmp/yum-root-Mo8_Vd/percona-release-latest.noarch.rpm: percona-release-1.0-12.noarch
Marking /var/tmp/yum-root-Mo8_Vd/percona-release-latest.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package percona-release.noarch 0:1.0-12 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                         Arch                   Version                  Repository                                      Size
======================================================================================================================================
Installing:
 percona-release                 noarch                 1.0-12                   /percona-release-latest.noarch                  19 k

Transaction Summary
======================================================================================================================================
Install  1 Package

Total size: 19 k
Installed size: 19 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : percona-release-1.0-12.noarch                                                                                      1/1
* Enabling the Percona Original repository
<*> All done!
The percona-release package now contains a percona-release script that can enable additional repositories for our newer products.

For example, to enable the Percona Server 8.0 repository use:

  percona-release setup ps80

Note: To avoid conflicts with older product versions, the percona-release setup command may disable our original repository for some products.

For more information, please visit:
  https://www.percona.com/doc/percona-repo-config/percona-release.html

  Verifying  : percona-release-1.0-12.noarch                                                                                      1/1

Installed:
  percona-release.noarch 0:1.0-12

Complete!
[root@localhost ~]#
Enable percona server 8.0 repo
[root@localhost ~]# percona-release setup ps80
* Disabling all Percona Repositories
* Enabling the Percona Server 8.0 repository
* Enabling the Percona Tools repository
<*> All done!
[root@localhost ~]#
Install percona server
[root@localhost ~]# sudo yum install percona-server-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.dionipe.net
 * epel: epel.dionipe.id
 * extras: mirror.dionipe.net
 * updates: mirror.dionipe.net
Resolving Dependencies
--> Running transaction check
---> Package percona-server-server.x86_64 0:8.0.16-7.1.el7 will be installed
--> Processing Dependency: percona-server-shared for package: percona-server-server-8.0.16-7.1.el7.x86_64
--> Processing Dependency: percona-server-client for package: percona-server-server-8.0.16-7.1.el7.x86_64
--> Processing Dependency: net-tools for package: percona-server-server-8.0.16-7.1.el7.x86_64
--> Running transaction check
---> Package net-tools.x86_64 0:2.0-0.24.20131004git.el7 will be installed
---> Package percona-server-client.x86_64 0:8.0.16-7.1.el7 will be installed
---> Package percona-server-shared.x86_64 0:8.0.16-7.1.el7 will be installed
--> Processing Dependency: percona-server-shared-compat for package: percona-server-shared-8.0.16-7.1.el7.x86_64
--> Running transaction check
---> Package percona-server-shared-compat.x86_64 0:8.0.16-7.1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                                 Arch              Version                              Repository                       Size
======================================================================================================================================
Installing:
 percona-server-server                   x86_64            8.0.16-7.1.el7                       ps-80-release-x86_64             51 M
Installing for dependencies:
 net-tools                               x86_64            2.0-0.24.20131004git.el7             base                            306 k
 percona-server-client                   x86_64            8.0.16-7.1.el7                       ps-80-release-x86_64             11 M
 percona-server-shared                   x86_64            8.0.16-7.1.el7                       ps-80-release-x86_64            1.2 M
 percona-server-shared-compat            x86_64            8.0.16-7.1.el7                       ps-80-release-x86_64            1.2 M

Transaction Summary
======================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total size: 64 M
Installed size: 347 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : net-tools-2.0-0.24.20131004git.el7.x86_64                                                                          1/5
  Installing : percona-server-shared-compat-8.0.16-7.1.el7.x86_64                                                                 2/5
  Installing : percona-server-shared-8.0.16-7.1.el7.x86_64                                                                        3/5
  Installing : percona-server-client-8.0.16-7.1.el7.x86_64                                                                        4/5
  Installing : percona-server-server-8.0.16-7.1.el7.x86_64                                                                        5/5
Percona Server is distributed with several useful UDF (User Defined Function) from Percona Toolkit.
Run the following commands to create these functions:
mysql -e "CREATE FUNCTION fnv1a_64 RETURNS INTEGER SONAME 'libfnv1a_udf.so'"
mysql -e "CREATE FUNCTION fnv_64 RETURNS INTEGER SONAME 'libfnv_udf.so'"
mysql -e "CREATE FUNCTION murmur_hash RETURNS INTEGER SONAME 'libmurmur_udf.so'"
See http://www.percona.com/doc/percona-server/8.0/management/udf_percona_toolkit.html for more details
  Verifying  : percona-server-client-8.0.16-7.1.el7.x86_64                                                                        1/5
  Verifying  : percona-server-shared-compat-8.0.16-7.1.el7.x86_64                                                                 2/5
  Verifying  : percona-server-server-8.0.16-7.1.el7.x86_64                                                                        3/5
  Verifying  : net-tools-2.0-0.24.20131004git.el7.x86_64                                                                          4/5
  Verifying  : percona-server-shared-8.0.16-7.1.el7.x86_64                                                                        5/5

Installed:
  percona-server-server.x86_64 0:8.0.16-7.1.el7

Dependency Installed:
  net-tools.x86_64 0:2.0-0.24.20131004git.el7                    percona-server-client.x86_64 0:8.0.16-7.1.el7
  percona-server-shared.x86_64 0:8.0.16-7.1.el7                  percona-server-shared-compat.x86_64 0:8.0.16-7.1.el7

Complete!
[root@localhost ~]#
Start mysql Server
[root@localhost ~]# service mysql start
Redirecting to /bin/systemctl start mysql.service
[root@localhost matomo]# service mysql status
Redirecting to /bin/systemctl status mysql.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-08-30 23:21:41 WIB; 8s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 9322 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 9398 (mysqld)
   Status: "SERVER_OPERATING"
   CGroup: /system.slice/mysqld.service
           └─9398 /usr/sbin/mysqld

Aug 30 23:21:32 localhost.localdomain systemd[1]: Starting MySQL Server...
Aug 30 23:21:41 localhost.localdomain systemd[1]: Started MySQL Server.
[root@localhost ~]#
Find the temporary password and login to mysql
[root@localhost ~]# sudo grep "temporary password" /var/log/mysqld.log 
2019-08-30T17:17:39.872841Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: jd*qBqWtM7lU
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.16-7

Copyright (c) 2009-2019 Percona LLC and/or its affiliates
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[root@localhost ~]# 
Update your temporary password before executing the statement
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyP@55';
Query OK, 0 rows affected (0.01 sec)

mysql>

How to create new mysql user on Percona MySql 8 server command

  Tidak ada komentar
How to create new mysql user on Percona MySql 8 server
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.16-7

Copyright (c) 2009-2019 Percona LLC and/or its affiliates
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE USER 'myuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'P@55w0rd';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

How to extend disk Linux Redhat 7 nutanix

  Tidak ada komentar





Checking the disk size
[root@devkapeldb01 ~]# df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/rhel_devkapeldb01-root   50G   50G  9.5M 100% /
devtmpfs                            7.8G     0  7.8G   0% /dev
tmpfs                               7.8G     0  7.8G   0% /dev/shm
tmpfs                               7.8G  8.5M  7.8G   1% /run
tmpfs                               7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                          1014M  143M  872M  15% /boot
/dev/mapper/rhel_devkapeldb01-home   42G   33M   42G   1% /home
tmpfs                               1.6G     0  1.6G   0% /run/user/0
[root@devkapeldb01 ~]#
Check the block size and disk block mapping
[root@devkapeldb01 ~]# lsblk
NAME                       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                          8:0    0  100G  0 disk
├─sda1                       8:1    0    1G  0 part /boot
└─sda2                       8:2    0   99G  0 part
  ├─rhel_devkapeldb01-root 253:0    0   50G  0 lvm  /
  ├─rhel_devkapeldb01-swap 253:1    0  7.9G  0 lvm  [SWAP]
  └─rhel_devkapeldb01-home 253:2    0 41.1G  0 lvm  /home
sr0                         11:0    1 1024M  0 rom
[root@devkapeldb01 ~]#
Check the physical volume
[root@devkapeldb01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_devkapeldb01
  PV Size               <99.00 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              25343
  Free PE               1
  Allocated PE          25342
  PV UUID               o1hXhV-0qQj-rB7n-UPnM-hwl0-KiTO-JWEuf1

[root@devkapeldb01 ~]#
Check the scsi host and rescan
[root@devkapeldb01 ~]# ls /sys/class/scsi_host/
host0  host1  host2
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# sudo echo "- - -" > /sys/class/scsi_host/host0/scan
[root@devkapeldb01 ~]# sudo echo "- - -" > /sys/class/scsi_host/host1/scan
[root@devkapeldb01 ~]# sudo echo "- - -" > /sys/class/scsi_host/host2/scan
[root@devkapeldb01 ~]#

Check the scsi device and rescan
[root@devkapeldb01 ~]# ls /sys/class/scsi_device/
0:0:0:0  2:0:0:0
[root@devkapeldb01 ~]# echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
[root@devkapeldb01 ~]# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
[root@devkapeldb01 ~]#
Perform running partition editor



[root@devkapeldb01 ~]# ls /dev/sd*
/dev/sda  /dev/sda1  /dev/sda2
[root@devkapeldb01 ~]#
Perform running partition editor





[root@devkapeldb01 ~]# fdisk /dev/sda

The device presents a logical sector size that is smaller than
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0x000c401d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   209715199   103808000   8e  Linux LVM

Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 is deleted

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0x000c401d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2099200-419430399, default 2099200):
Using default value 2099200
Last sector, +sectors or +size{K,M,G} (2099200-419430399, default 419430399):
Using default value 419430399
Partition 2 of type Linux and of size 199 GiB is set

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0x000c401d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   419430399   208665600   83  Linux

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC b
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep
1c  Hidden W95 FAT3 75  PC/IX           be  Solaris boot    ff  BBT
1e  Hidden W95 FAT1 80  Old Minix
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): p

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disk label type: dos
Disk identifier: 0x000c401d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   419430399   208665600   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@devkapeldb01 ~]#
Running partprobe command
[root@localhost ~]# partprobe
[root@localhost ~]#
Reboot the machine

[root@devkapeldb01 ~]# reboot now
login as: root
[email protected]'s password:
Last login: Fri Aug 30 14:46:42 2019 from 192.168.10.10
[root@devkapeldb01 ~]#
Check the physical volume after running partition 
[root@devkapeldb01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_devkapeldb01
  PV Size               <99.00 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              25343
  Free PE               1
  Allocated PE          25342
  PV UUID               o1hXhV-0qQj-rB7n-UPnM-hwl0-KiTO-JWEuf1

[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel_devkapeldb01/swap
  LV Name                swap
  VG Name                rhel_devkapeldb01
  LV UUID                xATCaa-rRJl-vDHT-zvcE-RPxW-dNLB-eV7RGF
  LV Write Access        read/write
  LV Creation host, time devkapeldb01.debhub.go.id, 2018-11-24 02:54:52 +0700
  LV Status              available
  # open                 2
  LV Size                <7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/rhel_devkapeldb01/home
  LV Name                home
  VG Name                rhel_devkapeldb01
  LV UUID                lIHRYR-VP7y-TbV6-7Nnb-02LA-7muA-UoYa8r
  LV Write Access        read/write
  LV Creation host, time devkapeldb01.debhub.go.id, 2018-11-24 02:54:52 +0700
  LV Status              available
  # open                 1
  LV Size                <41.12 GiB
  Current LE             10526
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/rhel_devkapeldb01/root
  LV Name                root
  VG Name                rhel_devkapeldb01
  LV UUID                8pH6bw-cP92-d775-kS7h-tQYr-iflF-oauCiA
  LV Write Access        read/write
  LV Creation host, time devkapeldb01.debhub.go.id, 2018-11-24 02:54:53 +0700
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel_devkapeldb01
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <99.00 GiB
  PE Size               4.00 MiB
  Total PE              25343
  Alloc PE / Size       25342 / 98.99 GiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               h2DHAh-nLJX-2kXY-18bR-9Yc6-Vzck-ja7WVU

[root@devkapeldb01 ~]#
Show the disk size
[root@devkapeldb01 ~]# df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/rhel_devkapeldb01-root   50G   50G  9.4M 100% /
devtmpfs                            7.8G     0  7.8G   0% /dev
tmpfs                               7.8G     0  7.8G   0% /dev/shm
tmpfs                               7.8G  8.5M  7.8G   1% /run
tmpfs                               7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                          1014M  143M  872M  15% /boot
/dev/mapper/rhel_devkapeldb01-home   42G   33M   42G   1% /home
tmpfs                               1.6G     0  1.6G   0% /run/user/0
[root@devkapeldb01 ~]#







Extend the physical volume
[root@devkapeldb01 ~]# pvresize /dev/sda2
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_devkapeldb01
  PV Size               <199.00 GiB / not usable 2.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              50943
  Free PE               25601
  Allocated PE          25342
  PV UUID               o1hXhV-0qQj-rB7n-UPnM-hwl0-KiTO-JWEuf1

[root@devkapeldb01 ~]#
Extend logical volume home
[root@devkapeldb01 ~]# lvextend -L +100G /dev/rhel_devkapeldb01/root
  Size of logical volume rhel_devkapeldb01/root changed from 50.00 GiB (12800 extents) to 150.00 GiB (38400 extents).
  Logical volume rhel_devkapeldb01/root successfully resized.
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# xfs_growfs /dev/mapper/rhel_devkapeldb01-root
meta-data=/dev/mapper/rhel_devkapeldb01-root isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13107200 to 39321600
[root@devkapeldb01 ~]#
Check the disk size after extending

[root@devkapeldb01 ~]# df -h
Filesystem                          Size  Used Avail Use% Mounted on
/dev/mapper/rhel_devkapeldb01-root  150G   50G  101G  34% /
devtmpfs                            7.8G     0  7.8G   0% /dev
tmpfs                               7.8G     0  7.8G   0% /dev/shm
tmpfs                               7.8G  8.4M  7.8G   1% /run
tmpfs                               7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                          1014M  143M  872M  15% /boot
/dev/mapper/rhel_devkapeldb01-home   42G   33M   42G   1% /home
tmpfs                               1.6G     0  1.6G   0% /run/user/0
[root@devkapeldb01 ~]#
Check the disk block mapping

[root@devkapeldb01 ~]# lsblk
NAME                       MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                          8:0    0  200G  0 disk
├─sda1                       8:1    0    1G  0 part /boot
└─sda2                       8:2    0  199G  0 part
  ├─rhel_devkapeldb01-root 253:0    0  150G  0 lvm  /
  ├─rhel_devkapeldb01-swap 253:1    0  7.9G  0 lvm  [SWAP]
  └─rhel_devkapeldb01-home 253:2    0 41.1G  0 lvm  /home
sr0                         11:0    1 1024M  0 rom
[root@devkapeldb01 ~]#
Check The PV, VG and LV

[root@devkapeldb01 ~]# pvs
  PV         VG                Fmt  Attr PSize    PFree
  /dev/sda2  rhel_devkapeldb01 lvm2 a--  <199.00g 4.00m
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# vgs
  VG                #PV #LV #SN Attr   VSize    VFree
  rhel_devkapeldb01   1   3   0 wz--n- <199.00g 4.00m
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]# lvs
  LV   VG                Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  home rhel_devkapeldb01 -wi-ao---- <41.12g                                     
  root rhel_devkapeldb01 -wi-ao---- 150.00g                                     
  swap rhel_devkapeldb01 -wi-ao----  <7.88g                                     
[root@devkapeldb01 ~]#
[root@devkapeldb01 ~]#



Selasa, 27 Agustus 2019

How to solve No space left on device: AH00023: Couldn't create the ssl-cache mutex

  Tidak ada komentar
Some day i got error No space left on device: AH00023: Couldn't create the ssl-cache mutex
[root@appsvr1 httpd]$ tail -n 50 error_log
...
...
[Wed Aug 28 11:49:17.839423 2019] [suexec:notice] [pid 2860] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 28 11:49:17.840236 2019] [core:emerg] [pid 2860] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex
AH00016: Configuration Failed
[Wed Aug 28 11:49:38.765141 2019] [suexec:notice] [pid 2979] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 28 11:49:38.765542 2019] [core:emerg] [pid 2979] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex
AH00016: Configuration Failed
[Wed Aug 28 11:59:35.988955 2019] [suexec:notice] [pid 3963] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 28 11:59:35.989647 2019] [core:emerg] [pid 3963] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex
AH00016: Configuration Failed
[Wed Aug 28 12:03:29.494480 2019] [suexec:notice] [pid 4537] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Aug 28 12:03:29.494937 2019] [core:emerg] [pid 4537] (28)No space left on device: AH00023: Couldn't create the ssl-cache mutex
AH00016: Configuration Failed
Running following command and restart the httpd service
[root@appsvr1 httpd]# ipcs | grep apache | awk '{print $2}' > sem.txt
[root@appsvr1 httpd]# for i in `cat sem.txt`; do { ipcrm -s $i; }; done;
[root@appsvr1 httpd]#
[root@appsvr1 httpd]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
[root@appsvr1 httpd]#
[root@appsvr1 httpd]# exit
exit
[ecpa@appsvr1 httpd]$
[ecpa@appsvr1 httpd]$ sudo service httpd status
[sudo] password for ecpa:
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-08-28 12:10:41 WIB; 45min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 5372 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 5077 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 5721 (httpd)
   Status: "Total requests: 3855; Current requests/sec: 28.9; Current traffic: 898KB/sec"
   CGroup: /system.slice/httpd.service
           ├─ 5721 /usr/sbin/httpd -DFOREGROUND
           ├─ 9982 /usr/sbin/httpd -DFOREGROUND
           ├─10143 /usr/sbin/httpd -DFOREGROUND
           ├─10534 /usr/sbin/httpd -DFOREGROUND

Senin, 19 Agustus 2019

How to install lynx for testing apache status

  Tidak ada komentar
Running following command line
[myuser@ipo conf.modules.d]$ sudo yum install lynx
Loaded plugins: fastestmirror
base                                                                                                           | 3.6 kB  00:00:00
epel/x86_64/metalink                                                                                           | 8.1 kB  00:00:00
epel                                                                                                           | 5.4 kB  00:00:00
extras                                                                                                         | 3.4 kB  00:00:00
remi-php56                                                                                                     | 2.2 kB  00:00:00
Not using downloaded remi-php56/repomd.xml because it is older than what we have:
  Current   : Wed Feb 13 23:03:25 2019
  Downloaded: Thu Jan  1 07:00:00 1970
remi-safe                                                                                                      | 2.2 kB  00:00:00
Not using downloaded remi-safe/repomd.xml because it is older than what we have:
  Current   : Wed Feb 13 22:56:41 2019
  Downloaded: Thu Jan  1 07:00:00 1970
updates                                                                                                        | 3.4 kB  00:00:00
(1/4): extras/7/x86_64/primary_db                                                                              | 215 kB  00:00:00
(2/4): epel/x86_64/updateinfo                                                                                  | 998 kB  00:00:02
(3/4): updates/7/x86_64/primary_db                                                                             | 7.4 MB  00:00:08
(4/4): epel/x86_64/primary_db                                                                                  | 6.8 MB  00:00:12
Determining fastest mirrors
 * base: mirror.axarva.id
 * epel: mirrors.aliyun.com
 * extras: mirror.axarva.id
 * remi-php56: remi.mirrors.cu.be
 * remi-safe: remi.mirrors.cu.be
 * updates: mirror.axarva.id
Resolving Dependencies
--> Running transaction check
---> Package lynx.x86_64 0:2.8.8-0.3.dev15.el7 will be installed
--> Processing Dependency: redhat-indexhtml for package: lynx-2.8.8-0.3.dev15.el7.x86_64
--> Running transaction check
---> Package centos-indexhtml.noarch 0:7-9.el7.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                             Arch                      Version                                  Repository               Size
======================================================================================================================================
Installing:
 lynx                                x86_64                    2.8.8-0.3.dev15.el7                      base                    1.4 M
Installing for dependencies:
 centos-indexhtml                    noarch                    7-9.el7.centos                           base                     92 k

Transaction Summary
======================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 1.5 M
Installed size: 5.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): centos-indexhtml-7-9.el7.centos.noarch.rpm                                                              |  92 kB  00:00:00
(2/2): lynx-2.8.8-0.3.dev15.el7.x86_64.rpm                                                                     | 1.4 MB  00:00:01
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 953 kB/s | 1.5 MB  00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : centos-indexhtml-7-9.el7.centos.noarch                                                                             1/2
  Installing : lynx-2.8.8-0.3.dev15.el7.x86_64                                                                                    2/2
  Verifying  : lynx-2.8.8-0.3.dev15.el7.x86_64                                                                                    1/2
  Verifying  : centos-indexhtml-7-9.el7.centos.noarch                                                                             2/2

Installed:
  lynx.x86_64 0:2.8.8-0.3.dev15.el7

Dependency Installed:
  centos-indexhtml.noarch 0:7-9.el7.centos

Complete!
[myuser@ipo conf.modules.d]$
[myuser@ipo conf.modules.d]$ lynx localost:8001/server-status
Running following command line
[myuser@ipo conf.modules.d]$ lynx localhost/server-status

How to configure apache status for check mk on Linux Centos 7

  Tidak ada komentar
Configure the httpd
[myuser@censtos conf.modules.d]$ sudo vi 00-server-status.conf
[myuser@censtos conf.modules.d]$
[myuser@censtos conf.modules.d]$ cat 00-server-status.conf
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#

Listen 8001
ExtendedStatus On
<VirtualHost *:8001>
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from localhost ip6-localhost
    #    Allow from .example.com
    </Location>
</VirtualHost>
</IfModule>
[myuser@censtos conf.modules.d]$
Configure apache status form cmk agent
myuser@centos:/etc/check_mk$ sudo vi apache_status.cfg
myuser@centos:/etc/check_mk$ sudo cat apache_status.cfg
[sudo] password for ecpa:
servers = [
{
 'protocol' : 'http',
 'address'  : 'localhost',
 'port'     : 80 ,
},
{
 'protocol' : 'https',
 'address'  : 'localhost',
 'port'     : 443 ,
 'page'     : 'server-status',
},
]
myuser@centos:/etc/check_mk$
Configure apache status form cmk agent
[myuser@centos httpd]$ cd /usr/lib/check_mk_agent/plugins/
[myuser@centos plugins]$
[myuser@centos plugins]$ vi apache_status
[myuser@centos plugins]$ sudo cat apache_status
[sudo] password for ecpa:
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2014             [email protected] |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# tails. You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.

# Check_MK-Agent-Plugin - Apache Server Status
#
# Fetches the server-status page from detected or configured apache
# processes to gather status information about this apache process.
#
# To make this agent plugin work you have to load the status_module
# into your apache process. It is also needed to enable the "server-status"
# handler below the URL "/server-status".
#
# By default this plugin tries to detect all locally running apache processes
# and to monitor them. If this is not good for your environment you might
# create an apache_status.cfg file in MK_CONFDIR and populate the servers
# list to prevent executing the detection mechanism.
#
# It is also possible to override or extend the ssl_ports variable to make the
# check contact other ports than 443 with HTTPS requests.
import os
import re
import socket
import sys
import urllib2
import ssl


config_dir = os.getenv("MK_CONFDIR", "/etc/check_mk")
config_file = config_dir + "/apache_status.conf"

if not os.path.exists(config_file):
    config_file = config_dir + "/apache_status.cfg"

# We have to deal with socket timeouts. Python > 2.6
# supports timeout parameter for the urllib2.urlopen method
# but we are on a python 2.5 system here which seem to use the
# default socket timeout. We are local here so  set it to 1 second.
socket.setdefaulttimeout(5.0)

# None or list of (proto, ipaddress, port) tuples.
# proto is 'http' or 'https'
servers = None
ssl_ports = [443]


if os.path.exists(config_file):
    execfile(config_file)


def try_detect_servers():
    results = []

    for line in os.popen('netstat -tlnp 2>/dev/null').readlines():
        parts = line.split()
        # Skip lines with wrong format
        if len(parts) < 7 or '/' not in parts[6]:
            continue

        pid, proc = parts[6].split('/', 1)
        to_replace = re.compile('^.*/')
        proc = to_replace.sub('', proc)

        procs = [ 'apache2', 'httpd', 'httpd2-prefork', 'httpd2-worker', 'httpd.worker', 'fcgi-pm' ]
        # the pid/proc field length is limited to 19 chars. Thus in case of
        # long PIDs, the process names are stripped of by that length.
        # Workaround this problem here
        procs = [ p[:19 - len(pid) - 1] for p in procs ]

        # Skip unwanted processes
        if proc not in procs:
            continue

        address, port = parts[3].rsplit(':', 1)
        port = int(port)

        # Use localhost when listening globally
        if address == '0.0.0.0':
            address = '127.0.0.1'
        elif address == '::':
            address = '[::1]'
        elif ':' in address:
            address = '[%s]' % address

        # Switch protocol if port is SSL port. In case you use SSL on another
        # port you would have to change/extend the ssl_port list
        if port in ssl_ports:
            proto = 'https'
        else:
            proto = 'http'

        results.append((proto, address, port))

    return results


if servers is None:
    servers = try_detect_servers()


if not servers:
    sys.exit(0)


sys.stdout.write('<<<apache_status>>>\n')
for server in servers:
    if isinstance(server, tuple):
        proto, address, port = server
        page = 'server-status'
    else:
        proto = server['protocol']
        address = server['address']
        port = server['port']
        page = server.get('page', 'server-status')

    portspec = port and ":%d" % port or ""

    try:
        url = '%s://%s%s/%s?auto' % (proto, address, portspec, page)
        # Try to fetch the status page for each server
        try:
            request = urllib2.Request(url, headers={"Accept" : "text/plain"})
            fd = urllib2.urlopen(request)
        except urllib2.URLError, e:
            if 'unknown protocol' in str(e):
                # HACK: workaround misconfigurations where port 443 is used for
                # serving non ssl secured http
                url = 'http://%s%s/server-status?auto' % (address, portspec)
                fd = urllib2.urlopen(url)
            else:
                raise
        except Exception, e:
            if 'doesn\'t match' in str(e) and address in ("127.0.0.1", "[::1]", "localhost"):
                # HACK: workaround if SSL port is found and localhost is using
                # SSL connections but certificate does not match
                no_cert_context = ssl.create_default_context()
                no_cert_context.check_hostname = False
                no_cert_context.verify_mode = ssl.CERT_NONE
                fd = urllib2.urlopen(url, context=no_cert_context)
            else:
                raise

        for line in fd.read().split('\n'):
            if not line.strip():
                continue
            if line.lstrip()[0] == '<':
                # Seems to be html output. Skip this server.
                break

            sys.stdout.write("%s %s %s\n" % (address, port, line))
    except urllib2.HTTPError, e:
        sys.stderr.write('HTTP-Error (%s%s): %s %s\n' % (address, portspec, e.code, e))

    except Exception, e:
        sys.stderr.write('Exception (%s%s): %s\n' % (address, portspec, e))
[myuser@centos plugins]$
[myuser@centos plugins]$ sudo chmod 775 apache_status