Senin, 31 Agustus 2020

MYSQL CLUSTER-owncloudx

 dbsa@dbsa-X406UA:~$ ssh root@172.16.9.193 

root@172.16.9.193's password:  
Last login: Tue Aug  4 16:25:43 2020 from 172.17.49.24

[root@own3 ~]# history 

   1  rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key
   2  curl -L https://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -o /etc/yum.repos.d/ownClou
d.repo
   3  yum clean expire-cache
   4  yum install owncloud -y
   5  cat /var/run/yum.pid
   6  kill -9 13593
   7  cat /var/run/yum.pid
   8  kill -9 13593
   9  yum clean expire-cache
  10  yum install owncloud -y
  11  yum update
  12  yum install epel-release
  13  rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
  14  yum install httpd php70w php70w-dom php70w-mbstring php70w-gd php70w-pdo php70w-json php70w-xml php70w-zip php70w-curl
php70w-mcrypt php70w-pear php70w-intl setroubleshoot-server
  15  rpm --import https://download.owncloud.org/download/repositories/10.0/CentOS_7/repodata/repomd.xml.key
  16  curl https://download.owncloud.org/download/repositories/10.0/CentOS_7/ce:10.0.repo | tee /etc/yum.repos.d/owncloud_CE
:10.0.repo
  17  yum install owncloud
  18  yum update
  19  cd /etc/yum.repos.d/
  20  ls
  21  vi owncloud_CE\:10.0.repo  
  22  yum update
  23  yum install owncloud
  24  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?'
  25  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?'
  26  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?'
  27  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.htaccess'
  28  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.user.ini'
  29  restorecon -Rv '/var/www/html/owncloud/'
  30  setsebool -P httpd_can_network_connect_db 1
  31  systemctl start httpd
  32  systemctl enable httpd
  33  firewall-cmd --add-service http --permanent
  34  firewall-cmd --add-service https --permanent
  35  firewall-cmd --reload
  36  yum remove mariadb-libs -y
  37  vim /etc/yum.repos.d/cluster.repo
  38  ls
  39  yum install socat
  40  yum install MariaDB-Galera-server MariaDB-client rsync galera
  41  systemctl start msyql
  42  mysql_secure_installation
  43  systemctl start mysql
  44  mysql_secure_installation
  45  systemctl restart httpd
  46  vim /etc/my.cnf.d/server.cnf
  47  reboot
  48  yum install mariadb-server php70w-mysql
  49  yum install php70w-mysql
  50  reboot
  51  mysql -uroot -p
  52  systemctl stop msyql
  53  systemctl stop mysql
  54  vim /etc/my.cnf.d/server.cnf
  55  poweroff
  56  vi /etc/hostname  
  57  reboot
  58  systemctl stop mysql
  59  vim /etc/my.cnf.d/server.cnf
  60  systemctl start mysql
  61  mysql -uroot -p
  62  vim /etc/my.cnf.d/server.cnf
  63  systemctl start mysql
  64  vim /etc/my.cnf.d/server.cnf
  65  cd /var/www/html/
  66   chown -R apache:apache owncloud/
  67  semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?'
  68  ls -l
  69  cd owncloud/
  70  ls
  71  ls -l
  72   systemctl status mysql
  73  mysql -uroot p
  74  mysql -uroot -p
  75   systemctl status mysql
  76  exit
  77   systemctl status mysql
  78  vim /etc/my.cnf.d/server.cnf
  79  mysql -uroot -p
  80  mysql -uroot -p --execute="SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_clus
ter_status', 'wsrep_connected');"
  81  ping 172.16.9.190
  82  vim /etc/my.cnf.d/server.cnf
  83  /etc/init.d/mysql start --wsrep-new-cluster
  84  mysql -uroot -p --execute="SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_clus
ter_status', 'wsrep_connected');"
  85  vim /etc/my.cnf.d/server.cnf
  86  sestatus
  87  sudo vi /etc/selinux/config
  88  reboot
  89  sestatus
  90   systemctl status mysql
  91   systemctl stop mysql
  92   systemctl start mysql
  93   systemctl status mysql
  94   systemctl start mysql
  95  exit
  96  vim /etc/my.cnf.d/server.cnf
  97  sudo systemctl stop firewalld
  98  sudo systemctl disable firewalld
  99  vim /etc/my.cnf.d/server.cnf
 100   systemctl stop mysql
 101   systemctl start mysql
 102   systemctl status mysql
 103  cd /var/www/html/owncloud/data/admin/
 104  ls
 105  cd ..
 106  ls -l
 107  cd admin/
 108  ls -l
 109  cd ..
 110  ls
 111  cd yogya
 112  ls
 113  cd ..
 114  ls -l
 115  vim /etc/my.cnf.d/server.cnf
 116   systemctl stop mysql
 117  vim /etc/my.cnf.d/server.cnf
 118  vi /etc/hostname  
 119  poweroff
 120  vim /etc/my.cnf.d/server.cnf
 121  reboot
 122  ifconfig
 123  vim /etc/my.cnf.d/server.cnf
 124  vi /etc/hostname  
 125  reboot
 126  vi /var/www/html/owncloud/config/config.php  
 127  yum install iscsi-initiator-utils -y
 128  vi /etc/iscsi/initiatorname.iscsi  
 129  iscsiadm -m discovery -t st -p 172.16.9.190
 130  systemctl restart iscsid.service
 131  systemctl enable iscsid.service
 132  iscsiadm -m node -T iqn.2017-10.server.alanprastyo.net:disk1 -p 192.168.122.120 -l
 133  1
 134  iscsiadm -m node -T iqn.2017-10.server.alanprastyo.net:disk1 -p 172.16.9.190 -l
 135  cat /proc/partitions  
 136  df -h
 137  mkfs.xfs /dev/sdb
 138  cd /mnt/
 139  mkdir cloud
 140  ls
 141  cd ..
 142  mount /dev/sda /mnt/cloud
 143  mount /dev/sdb /mnt/cloud
 144  df -h
 145  cd /mnt/cloud/
 146  ls
 147  vi harnedi.txt
 148  ls
 149  cd ..
 150  chmod 777 cloud/
 151  cd cloud/
 152  ls
 153  vi test.sh
 154  ls
 155  ls -l
 156  ls
 157  vi /var/www/html/owncloud/config/config.php  
 158  cd /var/www/html/owncloud/data/
 159  cp .ocdata /mnt/cloud/
 160  cd /mnt/
 161  chown -R apache:apache cloud/
 162  ls
 163  cd cloud/
 164  ls -l
 165  pwd
 166  cd ..
 167  ls
 168  umount /mnt/cloud  
 169  iscsiadm -m node -T iqn.2017-10.server.alanprastyo.net:disk1 -p 192.168.122.120 -u
 170  iscsiadm -m node -T iqn.2017-10.server.alanprastyo.net:disk1 -p 172.16.9.190 -u
 171  yum install -y nfs-utils
 172  mount -t nfs 172.16.9.190:/data/cloud /mnt/cloud
 173  ls
 174  cd cloud/
 175  ls
 176  df -h
 177  ls -l
 178  cd ..
 179  ls -l
 180  chown -R apache:apache cloud/
 181  ls -l
 182  cd cloud/
 183  ls -l
 184  nano /etc/fstab
 185  vi /etc/httpd/conf/httpd.conf
 186  service httpd restart
 187  vi /etc/fstab  
 188  exit
 189  yum install rhevm
 190  exit
 191  ifconfig
 192  vim /etc/my.cnf.d/server.cnf
 193   systemctl status mysql
 194  ping 10.9.9.191
 195  ping 10.9.9.192
 196  ping 10.9.9.190
 197  df -h
 198  ifconfig
 199  service iptables status
 200  history
 201  sestatus
 202  systemctl status mysql
 203  poweroff
 204  systemctl status mysql
 205  sudo systemctl status firewalld
 206  cd /var/www/html/owncloud/config/
 207  vi config.php  
 208  sudo yum install redis
 209  sudo systemctl start redis
 210  sudo systemctl enable redis
 211  sudo systemctl status redis
 212  vi config.php  
 213  service httpd restart
 214  vi config.php  
 215  service httpd restart
 216  vi config.php  
 217  yum install memcached php-pecl-memcache
 218  vi config.php  
 219  service httpd restart
 220  vi config.php  
 221  ss -an | grep 6379
 222  vi config.php  
 223  service httpd restart
 224  vi config.php  
 225  service httpd restart
 226  dpkg -l | grep apc
 227  vi config.php  
 228  service httpd restart
 229  vi config.php  
 230  service httpd restart
 231  yum-config-manager --disable remi-php54
 232  yum update
 233  yum install memcached php-pecl-memcache
 234   yum install php php-pecl-memcache
 235   yum install --skip-broken php php-pecl-memcache
 236   yum install --skip-broken php-pecl-memcache
 237  php -version
 238   yum install php php-pecl-memcache
 239  yum install php70w-bcmath
 240  yum install memcached php-pecl-memcache
 241  sudo yum install php70w --skip-broken
 242   yum install --skip-broken php-pecl-memcache
 243  mysql -uroot -p --execute="SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_clus
ter_status', 'wsrep_connected');"
 244  lsblk
 245  exit
 246  df -h
 247  mysql -uroot -p --execute="SHOW GLOBAL STATUS WHERE Variable_name IN ('wsrep_ready', 'wsrep_cluster_size', 'wsrep_clus
ter_status', 'wsrep_connected');"
 248  wget http://rpms.remirepo.net/enterprise/remi-release-7.rpm
 249  rpm -Uvh remi-release-7.rpm
 250  yum install php-opcache
 251  yum install php-pecl-apcu
 252  yum install --skip-broken php-pecl-apcu
 253  service httpd restart
 254  service php-fpm restart
 255  yum install --skip-broken php-pecl-apcu
 256  yum update
 257  yum install --skip-broken php-pecl-apcu
 258  yum update
 259  yum install --skip-broken php-pecl-apcu
 260  yum install --skip-broken libzip-0.10.1-8.el7.x86_64
 261  yum install --skip-broken php-common-5.4.16-48.el7.x86_64
 262  yum install --skip-broken php-common-5
 263  yum install --skip-broken php-pecl-apcu-4.0.11-1.el7.x86_64
 264  yum install --skip-broken php-pecl-apcu
 265  yum install  php-pecl-apcu
 266  yum install --skip-broken php-pecl-apcu
 267  yum remove php-common-5.4.16-48.el7.x86_64
 268  rpm -e php-common-5.4.16-48.el7.x86_64
 269  yum install php70
 270  yum install php70-php-mysqlnd php70-php-devel php70-php-gd php70-php-mcrypt php70-php-mbstring php70-php-pear php70-ph
p-pecl-imagick php70-php-pecl-zip
 271  yum install php-pecl-apcu
 272  yum install --skip-broken php-pecl-apcu
 273  rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 274  rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
 275  yum install php70w php70w-opcache
 276  cd /var/www/html/owncloud/config/
 277  vi config.php  
 278  service httpd restart
 279  cat << EOF > FILE_PATH
 280  ; Memcached PHP extension
 281  extension=memcached.so
 282  EOF
 283  cd /etc/opt/remi/php70/php.d/
 284  ls
 285  pwd
 286  yum install memcached php-pecl-memcache
 287  yum install --skip-broken memcached php-pecl-memcache
 288  systemctl start memcached
 289  systemctl enable memcached
 290  ps ax | grep memcached
 291  netstat -tlnp | grep memcached
 292  cat << EOF > FILE_PATH
 293  ; Memcached PHP extension
 294  extension=memcached.so
 295  EOF
 296  cd /etc/opt/remi/php70/php.d/
 297  ls -l
 298  service httpd restart
 299  vi /etc/redis.conf  
 300  sudo usermod -a -G redis apache
 301  service httpd restart
 302  service redis restart
 303  cd /var/www/html/owncloud/config/
 304  vi config.php  
 305  systemctl enable redis
 306  vi config.php  
 307  service httpd restart
 308  vi config.php  
 309  service httpd restart
 310  vi config.php  
 311  service httpd restart
 312  yum install rh-php70-php-devel
 313  pecl install apcu
 314  yum install rh-php70-php-devel
 315  exit
 316  cd /var/www/html/owncloud/config/
 317  vi config.php  
 318  service httpd restart
 319  exit
 320  yum install telnet
 321  telnet google.com 80
 322  yum install rh-php70-php-devel
 323  history
 324  yum install --skip-broken memcached php-pecl-memcache
 325  yum install php-common-5.4.16-48.el7.x86_64
 326  exit
 327  uname -a
 328  sudo nano /etc/sysconfig/memcached
 329  sudo netstat -tulpn | grep :11211
 330  sudo memcached-tool 127.0.0.1 stats
 331  sudo yum install php-pecl-memcache
 332  sudo yum install --skip-broken php-pecl-memcache
 333  yum update
 334  yum list installed *php*
 335  cd /var/www/html/owncloud/config/
 336  vi config.php  
 337  redis-cli ping
 338  vi /etc/redis.conf  
 339  history
 340  service redis restart
 341  redis-cli ping
 342  vi config.php  
 343  service httpd restart
 344  vi config.php  
 345  service httpd restart
 346  vi config.php  
 347  service httpd restart
 348  vi config.php  
 349  service httpd restart
 350  vi /etc/php.ini  
 351  php -i | grep "php.ini"
 352  vi /etc/php.ini  
 353  service httpd restart
 354  vi config.php  
 355  service httpd restart
 356  vi config.php  
 357  vi /etc/php.ini  
 358  service httpd restart
 359  apt-get install php-apcu
 360  yum install php-apcu
 361  yum install --skip-broken php-apcu
 362  ps ax | grep redis
 363  ps ax | grep memcached
 364  yum install php-redis
 365  vi config.php  
 366  service httpd restart
 367  yum clean all
 368  service httpd restart
 369  reboot
 370  yum remove php-redis
 371  service httpd restart
 372  cd /var/www/html/owncloud/config/
 373  vi config.php  
 374  service httpd restart
 375  firewall-cmd --permanent --zone=public --add-port=11211/tcp
 376  yum install perl-Cache-Memcached
 377  yum install php-pecl-memcache
 378  yum install --skip-broken php-pecl-memcache
 379  yum install --skip-broken php-common-5.4.16-48.el7.x86_64
 380  yum clean all
 381  yum -y update
 382  yum -y install php-pecl-memcache
 383  yum -y install --skip-broken php-pecl-memcache
 384  yum search php-pecl-redis
 385  yum install php-pecl-redis
 386  yum install --skip-broken php-pecl-redis
 387  yum install --skip-broken php-common-5.4.16-48.el7.x86_64
 388  yum install --skip-broken php-common
 389  yum install --skip-broken php-pecl-redis4
 390  yum install --skip-broken php-pecl-redis5
 391  yum install --skip-broken php-pecl-redis
 392  yum install --skip-broken php-pecl-redis-2.2.8-1.el7.x86_64
 393  yum search php-pecl-redis
 394  yum install --skip-broken php-pecl-redis.x86_64
 395  exit
 396  history
[root@own3 ~]#
[root@own3 ~]# cat /etc/my.cnf.d/server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]

binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
query_cache_size=0
query_cache_type=0
bind-address=0.0.0.0
datadir=/var/lib/mysql
innodb_log_file_size=100M
innodb_file_per_table
innodb_flush_log_at_trx_commit=2
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://172.16.9.191,172.16.9.192,172.16.9.193"
wsrep_cluster_name='galera_cluster'
wsrep_node_address='172.16.9.193'
wsrep_node_name='own3'
wsrep_sst_method=rsync
wsrep_sst_auth=db_user:admin

[root@own3 ~]#

Minggu, 30 Agustus 2020

RHV-ha hosted engine

 

OVirt 4.2.X Install HE (Hosted Engine) (4 Hosts) (2 SAN-HA) – Configure New Hosted Engine

This outlines the Configuration of the New Hosted Engine of the oVirt 4.2.x Install HE (Hosted Engine) (4 Hosts) (2 SAN-HA)

Login to https://ovirttestmgmt.<yourdomain>.com

Once logged in to the oVirt Engine WebUI:

  1.  Storage – Domains
    1. New
      1. Name: MainDataStore
      2. Function: Data
      3. Type: iSCSI
      4. Discover Targets – 10.10.9.3
      5. LUN – Targets – click + beside the 2 oVirtDATA targets
    2. New
      1. Name: ISO
      2. Function: ISO
      3. Type: NFS
      4. 172.16.1.80:/volume1/OVIRT/ISO
    3. New
      1. Name: EXPORT
      2. Function: Export
      3. Type: NFS
      4. 172.16.1.80:/volume1/OVIRT/EXPORT
    4. New
      1. Name: MIGRATE
      2. Function: DATA
      3. Type: NFS
      4. 172.16.1.80:/volume1/OVIRT/MIGRATE

You should now be able to run the following command on the command line of the HOST A server:

iscsiadm --m session --op show

You should see something like the following from the above command.

#tcp: [1] 10.10.10.3:3260,1 iqn.2000-01.com.synology:SynNAStestA.oVirtEngine.2776b78dce (non-flash)
#tcp: [2] 10.10.9.3:3260,1 iqn.2000-01.com.synology:SynNAStestA.oVirtEngine.2776b78dce (non-flash)
#tcp: [3] 10.10.10.3:3260,1 iqn.2000-01.com.synology:SynNAStestA.oVirtData.2776b78dce (non-flash)
#tcp: [4] 10.10.9.3:3260,1 iqn.2000-01.com.synology:SynNAStestA.oVirtData.2776b78dce (non-flash)

 

For VNC Connections run this

hosted-engine --add-console-password

 

#To enable libvirt command line calls run the following command. If you ever use libvirt commands you can use the username/password below to access them.

saslpasswd2 -a libvirt myfavoriteusername

 

If you SSH into the  oVirtEngineVM as root, run the following config commands:

#this sets up VNC as the default console type and will allow console to run in web browser
engine-config -g ClientModeVncDefault
engine-config -s ClientModeVncDefault=NoVnc
engine-config -g ClientModeVncDefault

UPDATE FENCING OPTIONS on ENGINE

engine-config -s vdsConnectionTimeout=2
engine-config -s vdsRetries=0

 

Setup engine backup

vi /root/backup_my_engine.sh
###
#!/bin/bash
#required for cronjob
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
export TERM=xterm
BUDATE=`date "+%Y-%m-%d-%H%M%S"`
engine-backup --mode=backup --file="engine-backup${BUDATE}.bak" --log="engine-backup${BUDATE}.log"
cp /root/engine-backup${BUDATE}* /mnt/backups/engine/
rm /root/engine-backup${BUDATE}*
###
vi /etc/crontab
#add the following line at the bottom
38 17 * * * root /root/backup_my_engine.sh > /dev/null 2>&1
vi /etc/fstab
#add this line to the bottom of the file
172.16.1.80:/volume1/OVIRT/EXPORT/3dd7043a-4df2-406a-866e-8590eba0755a/images /mnt/backups nfs rw,async,hard,intr,noexec 0 0
mkdir /mnt/backups
mount /mnt/backups
mkdir /mnt/backups/engine

Set UI to never end session

engine-config -s UserSessionTimeOutInterval=-1
service ovirt-engine restart

Setup Notifier

vi /usr/share/ovirt-engine/services/ovirt-engine-notifier/ovirt-engine-notifier.conf
#Add this to the end of the file
MAIL_SERVER=your.emailserver.com
MAIL_PORT=25
MAIL_USER=you@yourdomain.com
MAIL_PASSWORD=
MAIL_FROM=
MAIL_REPLY_TO=
systemctl daemon-reload
systemctl enable ovirt-engine-notifier.service
systemctl restart ovirt-engine-notifier.service

In the oVIRT WebUI do the following:

  1. Administration – Users
    1. Click on the admin username link
    2. Click on the Event Notifier (tab)
    3. Click “Manage Events” (button)
    4. Choose your events and add your email address
    5. Click Save
  2. Network – Networks
    1. Add
      1. Name: VMNIC1
      2. Check VM Network
      3. Cluster(tab)
      4. Uncheck Required
      5. Click OK
  3. Compute – Hosts
    1. Click HostA (virttestnodea.<yourdomain>.com)
    2. Network Interface(tab)
    3. Setup Network Interfaces(button)
      1. drag VMNIC1 to eth1
      2. Click OK