Author Topic: [ERROR] WSREP: failed to open gcomm backend connection: 110  (Read 5119 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
[ERROR] WSREP: failed to open gcomm backend connection: 110
« on: กรกฎาคม 01, 2017, 10:55:22 AM »
เจอปัญหาเกี่ยวกับ MariaDB-galera cluster เมื่อโหนดทั้งหมดที่เป็นตัว cluster ทำการปิดการทำงานลงพร้อมกัน แล้วไม่ได้เปิดใช้เป็นเวลานาน
อาจจะทำให้ตัว ตำแหน่งที่ทำการ sync ล่าสุดเคลื่อนได้ครับ หรือเวลาที่ปิด service mariadb พร้อมกัน เลยทำให้ mysql ยังปิดตัวได้ไม่สมบูรณ์ ก็จะทำให้เกิดปัญหาว่า เวลาเปิดขึ้นมาใหม่แล้ว mariadb cluster ไม่ทำงานครับ
Error :
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 updates.
To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .

Jul  1 10:26:28  mysqld: 2017-07-01 10:26:28  [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
Jul  1 10:26:28  mysqld: #011 at gcomm/src/pc.cpp:connect():158


หรือถ้าเช็คโดย netstat ก็จะไม่เจอว่า port 4567 ทำงานอยู่

แต่เราสามารถแก้ไขได้ง่ายๆ ครับ โดยขั้นแรกต้องตั้งสติให้ดีก่อน เพราะทุกปัญหามีทางออกเสมอ
ไปที่ตัว Primary node ครับ เข้าไปที่ /var/lib/mysql/grastate.dat
ทำการ vi เข้าไปปรับค่า  safe_to_bootstrap  จาก 0 ให้ปรับเป็น 1 ครับ เพื่อให้ระบบ mariadb-cluster ทำการซ่อมตำแหน่งให้กับ cluster ก่อน ถึงเปิดการทำงาน

# GALERA saved state
version: 2.1
uuid:    9acf4d34-acdb-11e6-bcc3-d3e36276629f
seqno:   15
safe_to_bootstrap: 1

หลังจากนั้นทำการ รัน command ให้ join cluster กันอีกรอบ พร้อมกับ debug log ไปด้วย
#service mysql bootstrap ; tail -f /var/log/syslog

ถ้าทำได้ไม่มี error ขึ้น ก็จะสามารถซ่อมตำแหน่งแล้วเปิดให้ cluster ทำงานได้อีกครั้ง
หลังจากนั้นก็ทำการ start node อื่นๆ ที่อยู่ใน clustering ครับ

node2#/etc/init.d/mysql start
node3#/etc/init.d/mysql start

เท่านี้ก็เรียบร้อยครับผม : )

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: [ERROR] WSREP: failed to open gcomm backend connection: 110
« Reply #1 on: กรกฎาคม 01, 2017, 10:59:08 AM »
HE SAFE-TO-BOOTSTRAP PROTECTION
In an orderly shutdown, the node that was shut down last will be the one that has the last transaction committed and should be chosen as the first node in the new cluster. Selecting another node for that role may cause errors down the road and open an opportunity for those last transactions to be lost.
To facilitate that decision and prevent unsafe choices, Galera, starting with version 3.19, will keep track of the order in which nodes are being shut down. The node that was shut down last will be marked as “Safe-to-Bootstrap” from. All the other nodes will be marked as unsafe to bootstrap from.
When bootstrapping the new cluster, Galera will refuse to use as a first node a node that was marked as unsafe to bootstrap from. You will see the following message in the logs:

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 updates.
To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .
In case of a sudden crash of the entire cluster, all nodes will be considered unsafe to bootstrap from, so operator action will always be required to force the use of a particular node as a bootstrap node.

http://galeracluster.com/2016/11/introducing-the-safe-to-bootstrap-feature-in-galera-cluster/