You can follow me with the link below;
http://www.forenda.com.tr/blog
Cheers.
Merhabalar,
bir müşterimiz yanlışlıkla Oracle RAC ortamında 2. node üzerindeki Oracle Home’u sildi. Sadece RDBMS home silindiği için cluster ayakta ve sorunsuz çalışıyor. Aşağıdaki adımları izleyerek 2. node’u kesintisiz olarak tekrar cluster’a ekledik.
[oracle@dbnode1 bin]$ ./runInstaller -updateNodeList ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1 "CLUSTER_NODES=dbnode1" Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 24574 MB Passed The inventory pointer is located at /etc/oraInst.loc The inventory is located at /u01/app/oraInventory 'UpdateNodeList' was successful.
[oracle@dbnode1 bin]$ ./addNode.sh -silent CLUSTER_NEW_NODES={dbnode2}
Performing pre-checks for node addition
Checking node reachability...
Node reachability check passed from node "dbnode1"
Checking user equivalence...
User equivalence check passed for user "oracle"
WARNING:
Node "dbnode2" already appears to be part of cluster
Pre-check for node addition was successful.
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 24574 MB Passed
Oracle Universal Installer, Version 11.2.0.4.0 Production
Copyright (C) 1999, 2013, Oracle. All rights reserved.
Performing tests to see whether nodes dbnode2 are available
............................................................... 100% Done.
.
-----------------------------------------------------------------------------
Cluster Node Addition Summary
Global Settings
Source: /u01/app/oracle/product/11.2.0.4/dbhome_1
New Nodes
Space Requirements
New Nodes
dbnode2
/u01: Required 5.97GB : Available 47.07GB
Installed Products
Product Names
Oracle Database 11g 11.2.0.4.0
Java Development Kit 1.5.0.51.10
Installer SDK Component 11.2.0.4.0
Oracle One-Off Patch Installer 11.2.0.3.4
Oracle Universal Installer 11.2.0.4.0
Oracle USM Deconfiguration 11.2.0.4.0
Oracle Configuration Manager Deconfiguration 10.3.1.0.0
Oracle DBCA Deconfiguration 11.2.0.4.0
Oracle RAC Deconfiguration 11.2.0.4.0
Oracle Database Deconfiguration 11.2.0.4.0
Oracle Configuration Manager Client 10.3.2.1.0
Oracle Configuration Manager 10.3.8.1.0
Oracle ODBC Driverfor Instant Client 11.2.0.4.0
LDAP Required Support Files 11.2.0.4.0
SSL Required Support Files for InstantClient 11.2.0.4.0
Bali Share 1.1.18.0.0
Oracle Extended Windowing Toolkit 3.4.47.0.0
Oracle JFC Extended Windowing Toolkit 4.2.36.0.0
Oracle Real Application Testing 11.2.0.4.0
Oracle Database Vault J2EE Application 11.2.0.4.0
Oracle Label Security 11.2.0.4.0
Oracle Data Mining RDBMS Files 11.2.0.4.0
Oracle OLAP RDBMS Files 11.2.0.4.0
Oracle OLAP API 11.2.0.4.0
Platform Required Support Files 11.2.0.4.0
Oracle Database Vault option 11.2.0.4.0
Oracle RAC Required Support Files-HAS 11.2.0.4.0
SQL*Plus Required Support Files 11.2.0.4.0
Oracle Display Fonts 9.0.2.0.0
Oracle Ice Browser 5.2.3.6.0
Oracle JDBC Server Support Package 11.2.0.4.0
Oracle SQL Developer 11.2.0.4.0
Oracle Application Express 11.2.0.4.0
XDK Required Support Files 11.2.0.4.0
RDBMS Required Support Files for Instant Client 11.2.0.4.0
SQLJ Runtime 11.2.0.4.0
Database Workspace Manager 11.2.0.4.0
RDBMS Required Support Files Runtime 11.2.0.4.0
Oracle Globalization Support 11.2.0.4.0
Exadata Storage Server 11.2.0.1.0
Provisioning Advisor Framework 10.2.0.4.3
Enterprise Manager Database Plugin -- Repository Support 11.2.0.4.0
Enterprise Manager Repository Core Files 10.2.0.4.5
Enterprise Manager Database Plugin -- Agent Support 11.2.0.4.0
Enterprise Manager Grid Control Core Files 10.2.0.4.5
Enterprise Manager Common Core Files 10.2.0.4.5
Enterprise Manager Agent Core Files 10.2.0.4.5
RDBMS Required Support Files 11.2.0.4.0
regexp 2.1.9.0.0
Agent Required Support Files 10.2.0.4.5
Oracle 11g Warehouse Builder Required Files 11.2.0.4.0
Oracle Notification Service (eONS) 11.2.0.4.0
Oracle Text Required Support Files 11.2.0.4.0
Parser Generator Required Support Files 11.2.0.4.0
Oracle Database 11g Multimedia Files 11.2.0.4.0
Oracle Multimedia Java Advanced Imaging 11.2.0.4.0
Oracle Multimedia Annotator 11.2.0.4.0
Oracle JDBC/OCI Instant Client 11.2.0.4.0
Oracle Multimedia Locator RDBMS Files 11.2.0.4.0
Precompiler Required Support Files 11.2.0.4.0
Oracle Core Required Support Files 11.2.0.4.0
Sample Schema Data 11.2.0.4.0
Oracle Starter Database 11.2.0.4.0
Oracle Message Gateway Common Files 11.2.0.4.0
Oracle XML Query 11.2.0.4.0
XML Parser for Oracle JVM 11.2.0.4.0
Oracle Help For Java 4.2.9.0.0
Installation Plugin Files 11.2.0.4.0
Enterprise Manager Common Files 10.2.0.4.5
Expat libraries 2.0.1.0.1
Deinstallation Tool 11.2.0.4.0
Oracle Quality of Service Management (Client) 11.2.0.4.0
Perl Modules 5.10.0.0.1
JAccelerator (COMPANION) 11.2.0.4.0
Oracle Containers for Java 11.2.0.4.0
Perl Interpreter 5.10.0.0.2
Oracle Net Required Support Files 11.2.0.4.0
Secure Socket Layer 11.2.0.4.0
Oracle Universal Connection Pool 11.2.0.4.0
Oracle JDBC/THIN Interfaces 11.2.0.4.0
Oracle Multimedia Client Option 11.2.0.4.0
Oracle Java Client 11.2.0.4.0
Character Set Migration Utility 11.2.0.4.0
Oracle Code Editor 1.2.1.0.0I
PL/SQL Embedded Gateway 11.2.0.4.0
OLAP SQL Scripts 11.2.0.4.0
Database SQL Scripts 11.2.0.4.0
Oracle Locale Builder 11.2.0.4.0
Oracle Globalization Support 11.2.0.4.0
SQL*Plus Files for Instant Client 11.2.0.4.0
Required Support Files 11.2.0.4.0
Oracle Database User Interface 2.2.13.0.0
Oracle ODBC Driver 11.2.0.4.0
Oracle Notification Service 11.2.0.3.0
XML Parser for Java 11.2.0.4.0
Oracle Security Developer Tools 11.2.0.4.0
Oracle Wallet Manager 11.2.0.4.0
Cluster Verification Utility Common Files 11.2.0.4.0
Oracle Clusterware RDBMS Files 11.2.0.4.0
Oracle UIX 2.2.24.6.0
Enterprise Manager plugin Common Files 11.2.0.4.0
HAS Common Files 11.2.0.4.0
Precompiler Common Files 11.2.0.4.0
Installation Common Files 11.2.0.4.0
Oracle Help for the Web 2.0.14.0.0
Oracle LDAP administration 11.2.0.4.0
Buildtools Common Files 11.2.0.4.0
Assistant Common Files 11.2.0.4.0
Oracle Recovery Manager 11.2.0.4.0
PL/SQL 11.2.0.4.0
Generic Connectivity Common Files 11.2.0.4.0
Oracle Database Gateway for ODBC 11.2.0.4.0
Oracle Programmer 11.2.0.4.0
Oracle Database Utilities 11.2.0.4.0
Enterprise Manager Agent 10.2.0.4.5
SQL*Plus 11.2.0.4.0
Oracle Netca Client 11.2.0.4.0
Oracle Multimedia Locator 11.2.0.4.0
Oracle Call Interface (OCI) 11.2.0.4.0
Oracle Multimedia 11.2.0.4.0
Oracle Net 11.2.0.4.0
Oracle XML Development Kit 11.2.0.4.0
Oracle Internet Directory Client 11.2.0.4.0
Database Configuration and Upgrade Assistants 11.2.0.4.0
Oracle JVM 11.2.0.4.0
Oracle Advanced Security 11.2.0.4.0
Oracle Net Listener 11.2.0.4.0
Oracle Enterprise Manager Console DB 11.2.0.4.0
HAS Files for DB 11.2.0.4.0
Oracle Text 11.2.0.4.0
Oracle Net Services 11.2.0.4.0
Oracle Database 11g 11.2.0.4.0
Oracle OLAP 11.2.0.4.0
Oracle Spatial 11.2.0.4.0
Oracle Partitioning 11.2.0.4.0
Enterprise Edition Options 11.2.0.4.0
-----------------------------------------------------------------------------
Instantiating scripts for add node (Monday, December 10, 2018 9:26:50 PM EET)
. 1% Done.
Instantiation of add node scripts complete
Copying to remote nodes (Monday, December 10, 2018 9:26:52 PM EET)
............................................................................................... 96% Done.
Home copied to new nodes
Saving inventory on nodes (Monday, December 10, 2018 9:33:43 PM EET)
. 100% Done.
Save inventory complete
WARNING:
The following configuration scripts need to be executed as the "root" user in each new cluster node. Each script in the list below is followed by a list of nodes.
/u01/app/oracle/product/11.2.0.4/dbhome_1/root.sh #On nodes dbnode2
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts in each cluster node
The Cluster Node Addition of /u01/app/oracle/product/11.2.0.4/dbhome_1 was successful.
Please check '/tmp/silentInstall.log' for more details.
Merhaba,
aşağıdaki bash scripti ile Oracle alert log’una basılan hataları mail olarak html formatında alabilirsiniz.
#!/usr/bin/bash
#27.02.2018 Oracle database alert log control script.
#Erman Ibrisim
#script kullanimi: /home/oracle/scripts/check_alert_log.sh <ORACLE_SID>
#script kullanimi: /home/oracle/scripts/check_alert_log.sh db1
######### Set Env #########
export ORACLE_HOME=/u01/app/oracle/product/12.1.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH:/bin:/usr/bin:usr/local/bin:.
export ORACLE_SID=$1
export DBFILE=alert_log_${1}.html
export FDATE=$(date +'%d%m%y')
export DDATE=$(date +'%H:%M:%S-%d%m%y')
export EMAIL="dba@gantek.com"
cd /home/oracle/scripts/logs
##################################
sqlplus -s / as sysdba << EOF
set termout off
SET linesize 200
SET show off
SET feed off
set pages 999
SET MARKUP HTML ON TABLE "class=emp cellspacing=0 BORDER=1" ENTMAP OFF
col INST_ID format 99 heading "<p class=left>INST_ID</p>"
col ORIGINATING_TIMESTAMP format a35 heading "<p class=left>ORIGINATING_TIMESTAMP</p>"
col HOST_ID format a25 heading "<p class=left>HOST_ID</p>"
col MODULE_ID format a20 heading "<p class=left>MODULE_ID</p>"
col MESSAGE_TEXT format a50 heading "<p class=left>MESSAGE_TEXT</p>"
spool ${DBFILE}
SELECT INST_ID, ORIGINATING_TIMESTAMP, HOST_ID, MODULE_ID, MESSAGE_TEXT, 'SEND_MAIL' MAIL_CHECK FROM sys.X\$DBGALERTEXT WHERE UPPER(MESSAGE_TEXT) LIKE '%ORA-%' AND ORIGINATING_TIMESTAMP >= SYSDATE - 1/24
ORDER BY ORIGINATING_TIMESTAMP DESC;
spool off;
exit;
EOF
########## Send Mail ##############
db_error_count="$(/usr/bin/find . -name ${DBFILE} -print | xargs egrep 'SEND_MAIL' | wc -l)"
if [[ $((db_error_count)) != 0 ]];
then
export EMAIL="dba@gantek.com"
cat ${DBFILE} | /usr/bin/mailx -s "[Warning][Database] $1 DB Alert Log Script" -S smtp=smtp://smtp.com.tr -S smtp-auth=login -S smtp-auth-user=smtp@smtp.com.tr -S smtp-auth-password=123 -S from="Database Monitoring <customer@domain.com.tr>" ${EMAIL}
#Logun yedegini al.
mv ${DBFILE} ${DBFILE}_${DDATE}
fi
##################################
crontab içeriği;
00,30 * * * * /home/oracle/scripts/check_alert_log.sh db1 00,30 * * * * /home/oracle/scripts/check_alert_log.sh db2 00,30 * * * * /home/oracle/scripts/check_alert_log.sh db3
Alınan hata;
[root@rhelmysql1 ~]# systemctl start mysql@bootstrap.service Job for mysql@bootstrap.service failed because the control process exited with error code. See "systemctl status mysql@bootstrap.service" and "journalctl -xe" for details. Jul 13 15:16:50 rhelmysql1.gantek.com mysqld[30101]: 2017-07-13 15:16:50 30100 [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. It was not the last one to leave the cluster and may not contain all the update Jul 13 15:16:50 rhelmysql1.gantek.com mysqld[30101]: 2017-07-13 15:16:50 30100 [ERROR] WSREP: wsrep::connect(gcomm://10.0.3.230,10.0.3.231) failed: 7 Jul 13 15:16:50 rhelmysql1.gantek.com mysqld[30101]: 2017-07-13 15:16:50 30100 [ERROR] Aborting Jul 13 15:16:50 rhelmysql1.gantek.com mysqld[30101]:
Neden;
Percona cluster tutarsız kapandığı zaman karşılaşılabilir. Tutarsız kapandığı için cluster en son hangi node’un kapandığından emin olamadığı için veri bütünlüğünü sağlamak için bootstrap olarak mysql’i açmıyor.
Çözüm;
Hangi node’un en son kapandığı tespit edildikten sonra safe_to_bootstrap parametresi ile bootstrap force edilebilir.
[root@rhelmysql2 ~]# cat /var/lib/mysql/grastate.dat
# GALERA saved state
version: 2.1
uuid: f3cffdda-6799-11e7-b936-8758143b1b90
seqno: -1
safe_to_bootstrap: 1
- Daha sonra mysql'i bootstrap komutu ile açıyorum.
systemctl start mysql@bootstrap.service
[root@rhel04 ~]# srvctl config scan SCAN name: rhel-scan.gantek.com, Network: 1/10.0.3.0/255.255.255.0/eth0 SCAN VIP name: scan1, IP: /rhel-scan.gantek.com/10.0.3.185 SCAN VIP name: scan2, IP: /rhel-scan.gantek.com/10.0.3.186 SCAN VIP name: scan3, IP: /rhel-scan.gantek.com/10.0.3.187 [root@rhel04 ~]# oifcfg getif eth0 10.0.3.0 global public eth1 192.168.3.0 global cluster_interconnect [root@rhel04 ~]# oifcfg iflist -p -n eth0 10.0.3.0 PRIVATE 255.255.255.0 eth1 192.168.3.0 PRIVATE 255.255.255.0 eth1 169.254.0.0 UNKNOWN 255.255.0.0 [root@rhel04 ~]# srvctl config network Network exists: 1/10.0.3.0/255.255.255.0/eth0, type static [grid@rhel03 ~]$ srvctl config nodeapps -a Network exists: 1/10.0.3.0/255.255.255.0/eth0, type static VIP exists: /rhel03-vip/10.0.3.173/10.0.3.0/255.255.255.0/eth0, hosting node rhel03 VIP exists: /rhel04-vip/10.0.3.175/10.0.3.0/255.255.255.0/eth0, hosting node rhel04
selamlar,
aşağıdaki komut ile cluster name öğrenilebilir.
[root@rhel03 ~]# cemutlo -h Usage: /u01/app/11.2.0/grid/bin/cemutlo.bin [-n] [-w] where: -n prints the cluster name -w prints the clusterware version in the following format: <major_version>:<minor_version>:<vendor_info> [root@rhel03 ~]# cemutlo -w 2:1: [root@rhel03 ~]# cemutlo -n rhel-cluster
Selamlar,
prod ortamında gece çalışan bir batch job’da aşağıdaki şekilde hatalar aldık.
Sat Sep 23 00:03:08 2017 Errors in file /u01/app/oracle/diag/rdbms/*****/*****1/trace/*****1_j000_19049.trc (incident=90554): ORA-04030: 16328 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (koh-kghu call , pmuccst: adt/record) Incident details in: /u01/app/oracle/diag/rdbms/*****/*****1/incident/incdir_90554/*****1_j000_19049_i90554.trc Use ADRCI or Support Workbench to package the incident. See Note 411.1 at My Oracle Support for error and packaging details. Errors in file /u01/app/oracle/diag/rdbms/*****/*****1/trace/*****1_j000_19049.trc (incident=90555): ORA-04030: 169040 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (pga heap, kgh stack) ORA-04030: 16328 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (koh-kghu call , pmuccst: adt/record) Incident details in: /u01/app/oracle/diag/rdbms/*****/*****1/incident/incdir_90555/*****1_j000_19049_i90555.trc Use ADRCI or Support Workbench to package the incident. See Note 411.1 at My Oracle Support for error and packaging details. Sat Sep 23 00:03:13 2017 Dumping diagnostic data in directory=[cdmp_20170923000313], requested by (instance=1, osid=19049 (J000)), summary=[incident=90555]. Use ADRCI or Support Workbench to package the incident. See Note 411.1 at My Oracle Support for error and packaging details. Sat Sep 23 00:03:14 2017 Errors in file /u01/app/oracle/diag/rdbms/*****/*****1/incident/incdir_90554/*****1_j000_19049_i90554.trc: ORA-04030: 169040 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (pga heap, kgh stack) ORA-04030: 16328 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (koh-kghu call , pmuccst: adt/record) Errors in file /u01/app/oracle/diag/rdbms/*****/*****1/trace/*****1_j000_19049.trc (incident=90556): ORA-04030: 311832 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (pga heap, control file i/o buffer) ORA-04030: 16328 bayt ayrýlmaya çalýþýlýrken iþlem belleði tükendi (koh-kghu call , pmuccst: adt/record) Incident details in: /u01/app/oracle/diag/rdbms/*****/*****1/incident/incdir_90556/*****1_j000_19049_i90556.trc Use ADRCI or Support Workbench to package the incident. See Note 411.1 at My Oracle Support for error and packaging details.
Sorunun nedeni vm sunuculardaki max_map_count parametresi ve db üzerindeki _realfree_heap_pagesize (12.1) – _realfree_heap_pagesize_hint (11.2) hidden parametreleri.
Parametlerin mevcut değerlerini kontrol ediyorum;
[root@rac0 ~]# more /proc/sys/vm/max_map_count 65530 _realfree_heap_pagesize -> 65530
vi /etc/sysctl.conf . . . vm.max_map_count=524288
alter system set "_use_realfree_heap "=TRUE scope=spfile; alter system set "_realfree_heap_pagesize_hint "=524288 scope=spfile;
alter system set "_use_realfree_heap "=TRUE scope=spfile; alter system set "_realfree_heap_pagesize "=524288 scope=spfile;
Böylelikle sorun çözülmüş oldu.
Kaynak:
PLSQL Procedure Causing ORA-04030: (pga heap,control file i/o buffer) And ORA-04030: (koh-kghu sessi,pmuccst: adt/record) or ORA-04030: (koh-kghucall ,pmucalm coll) Errors (Doc ID 1325100.1)
1. /etc/my.cnf dosyasına aşağıdaki parametreler eklenir
log-bin=mysql-bin server-id=1 binlog-do-db=erman -> erman ismindeki database replike edilecek.
2. mysql restart edilir
systemctl restart mysqld
3. slave sunucudan master’a başlanıp bin log’ları almak için bir user create edilir.
CREATE USER 'SLAVEUSR'@'%' IDENTIFIED BY 'slave123'; GRANT REPLICATION SLAVE ON *.* TO 'SLAVEUSR'@'%' IDENTIFIED BY 'slave123'; FLUSH PRIVILEGES;
4. Master database’de kesinti almak gerekmektedir. Replike edilecek database’e bağlanılıp tüm tablolar lock’lanır. Daha sonra master sunucunun status bilgisi alınıp kenara not edilir.
mysql> USE erman; mysql> FLUSH TABLES WITH READ LOCK; mysql> SHOW MASTER STATUS\G *************************** 1. row *************************** File: mysql-bin.000007 Position: 154 Binlog_Do_DB: erman Binlog_Ignore_DB: Executed_Gtid_Set: 1 row in set (0.00 sec)
Bu işlem için mysqldump ya da direk OS üzerindeki rsync komutu kullanılabilir. Ben mysqldump ile işlemi gerçekleştiriyorum.
1. mysqldump ile erman database’inin tamamı dışarı çıkartılır.
mysqldump -h 10.0.3.191 -u root -pmysql123 erman > erman_database.sql
2. erman_database.sql dosyası slave sunucusuna scp ile atılır.
scp erman_database.sql root@10.0.3.192:/root
3. erman database’inin t anındaki hali mysqldump ile dışarı alındığı için artık production’da table’lar unlock edilebilir.
mysql> USE erman; mysql> UNLOCK TABLES;
1. erman isminde bir database create edilir.
mysql> use erman; mysql> create database erman;
2. alınan dump restore edilir
mysql -u root -pmysql123 erman < /root/erman_database.sql
3. /etc/my.cnf dosyasına aşağıdaki parametre eklenir.
server-id=5
4. mysql restart edilir
systemctl restart mysqld
5. slave’e bağlanılıp replikasyon başlatılır. Daha önce master’dan alınan status bilgisinden faydalanılır.
mysql> stop slave;
mysql> CHANGE MASTER TO MASTER_HOST='10.0.3.191',
MASTER_USER='SLAVEUSR', --> büyük/küçük harf duyarlı
MASTER_PASSWORD='slave123',
MASTER_LOG_FILE='mysql-bin.000007',
MASTER_LOG_POS=154;
mysql> start slave;
6. replikasyon kontrol edilir. Slave_IO_Running ve Slave_SQL_Running parametrelerinin YES olması ve herhangi bir error olmaması gerekmektedir.
mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 10.0.3.191 Master_User: SLAVE_USER Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000007 Read_Master_Log_Pos: 668 Relay_Log_File: rhelmysql2-relay-bin.000002 Relay_Log_Pos: 834 Relay_Master_Log_File: mysql-bin.000007 Slave_IO_Running: Yes Slave_SQL_Running: Yes Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0 Last_Error: Skip_Counter: 0 Exec_Master_Log_Pos: 668 Relay_Log_Space: 1046 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0 Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 0 Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 9f961063-985a-11e7-bd07-005056a6c747 Master_Info_File: /data/master.info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 1 row in set (0.00 sec)
7. test amaçlı tablo create edilerek test yapılır.
Node1
mysql> use erman; mysql> create table test (id integer); mysql> insert into test values(1); mysql> insert into test values(2); mysql> commit;
Node2
mysql> use erman; mysql> select * from test; +------+ | id | +------+ | 1 | | 2 | +------+ 2 rows in set (0.00 sec)
systemctl stop mysqld
2. add skip-grant-tables parameter to /etc/mycnf
vi /etc/my.cnf . . . skip-grant-tables
3. start mysql
systemctl start mysqld
4. connect mysql without password
[root@rhelmysql1 ~]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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>
5. change root password
mysql> UPDATE mysql.user
-> SET authentication_string = PASSWORD('root123'), password_expired = 'N'
-> WHERE User = 'root';
Query OK, 0 rows affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> commit;
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
6. restart mysql
systemctl restart mysqld
7. connect mysql with new password
[root@rhelmysql1 ~]# mysql -u root -proot123 mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2017, 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>
1. mysql,mariadb ya da percona yüklü mü onu kontrol et
sudo rpm -qa | egrep -i "(Maria|MySQL|Percona)" yum remove mariadb-libs-5.5.52-1.el7.x86_64
2. unzip binary
[root@rh7node1 mysql]# unzip V839934-01.zip Archive: V839934-01.zip extracting: mysql-commercial-client-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-embedded-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-test-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-embedded-compat-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-libs-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-libs-compat-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-common-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-embedded-devel-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-server-5.7.17-1.1.el7.x86_64.rpm extracting: mysql-commercial-devel-5.7.17-1.1.el7.x86_64.rpm extracting: README.txt
3. install rpms
[root@rh7node1 mysql]# rpm -ivh mysql-commercial-{server,client,common,libs}-*
warning: mysql-commercial-server-5.7.17-1.1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-commercial-common-5.7.17-1.################################# [ 20%]
2:mysql-commercial-libs-5.7.17-1.1.################################# [ 40%]
3:mysql-commercial-client-5.7.17-1.################################# [ 60%]
4:mysql-commercial-server-5.7.17-1.################################# [ 80%]
5:mysql-commercial-libs-compat-5.7.################################# [100%]
4. change configuration
vi /etc/my.cnf datadir=/mnt/sql port=3306 bind-address = 10.1.1.150
chown -R mysql:mysql /mnt/sql
5. install mysql
[root@rh7node1 sql]# mysql_install_db --user=mysql --datadir=/mnt/sql/mysql 2017-03-12 21:40:59 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize [root@rh7node1 sql]# ls -l mysql/ total 110916 -rw-r----- 1 mysql mysql 56 Mar 12 21:41 auto.cnf -rw------- 1 mysql mysql 1676 Mar 12 21:41 ca-key.pem -rw-r--r-- 1 mysql mysql 1075 Mar 12 21:41 ca.pem -rw-r--r-- 1 mysql mysql 1079 Mar 12 21:41 client-cert.pem -rw------- 1 mysql mysql 1676 Mar 12 21:41 client-key.pem -rw-r----- 1 mysql mysql 413 Mar 12 21:41 ib_buffer_pool -rw-r----- 1 mysql mysql 12582912 Mar 12 21:41 ibdata1 -rw-r----- 1 mysql mysql 50331648 Mar 12 21:41 ib_logfile0 -rw-r----- 1 mysql mysql 50331648 Mar 12 21:40 ib_logfile1 drwxr-x--- 2 mysql mysql 2048 Mar 12 21:41 mysql drwxr-x--- 2 mysql mysql 2048 Mar 12 21:41 performance_schema -rw------- 1 mysql mysql 1680 Mar 12 21:41 private_key.pem -rw-r--r-- 1 mysql mysql 452 Mar 12 21:41 public_key.pem -rw-r--r-- 1 mysql mysql 1079 Mar 12 21:41 server-cert.pem -rw------- 1 mysql mysql 1676 Mar 12 21:41 server-key.pem drwxr-x--- 2 mysql mysql 2048 Mar 12 21:41 sys
6. start mysql service
service mysqld start
7. find default password
[root@rh7node1 mysql]# cd [root@rh7node1 ~]# cat .mysql_secret # Password set for user 'root@localhost' at 2017-03-12 21:40:59 h#ARI)Hb6p-H
8. change mysql root password
mysql -u root -p
set global validate_password_policy=LOW;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mysql123');
SET PASSWORD FOR 'root'@'%' = PASSWORD('mysql123');
UPDATE mysql.user
SET authentication_string = PASSWORD('mysql123'), password_expired = 'N'
WHERE User = 'root' AND Host = '%';
FLUSH PRIVILEGES;
9. create app user
CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass'; GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' WITH GRANT OPTION; CREATE USER 'erman'@'%' IDENTIFIED BY 'erman123'; GRANT ALL PRIVILEGES ON *.* TO 'erman'@'%' WITH GRANT OPTION;
10. check character set
mysql -u root -p SHOW VARIABLES LIKE 'character_set_system'; USE db_name; SELECT @@character_set_database, @@collation_database;