คำสั่ง 4 ตัวอักษร
Apache ZooKeeper มี "คำสั่ง 4 ตัวอักษร" จำนวนหนึ่งซึ่งอาจเป็นประโยชน์ในการระบุสถานะปัจจุบันของผู้มีสิทธิ์เลือกตั้งและโหนดผู้สังเกตการณ์ของ ZooKeeper คุณเรียกใช้คำสั่งเหล่านี้ได้โดยใช้ nc
, telnet
หรือยูทิลิตีอื่นที่สามารถส่งคำสั่งไปยังพอร์ตที่ระบุได้ ดูรายละเอียดเกี่ยวกับคำสั่ง 4 ตัวอักษรได้ในข้อมูลอ้างอิงคำสั่ง Apache ZooKeeper
การนำไฟล์สแนปชอตเก่าออก
Apache ZooKeeper จะทำการบำรุงรักษาเป็นระยะโดยอัตโนมัติเพื่อนำไฟล์สแนปชอตเก่าสะสมเมื่อมีการอัปเดตระบบออก การตั้งค่าต่อไปนี้ใน /opt/apigee/apigee-zookeeper/conf/zoo.cfg
จะควบคุมกระบวนการนี้
## The number of snapshots to retain in dataDir: autopurge.snapRetainCount=5 # Purge task interval in hours. # Set to "0" to disable auto purge feature. autopurge.purgeInterval=120
หากต้องการตั้งค่าคุณสมบัติเหล่านี้เป็นค่าอื่น ให้ทำดังนี้
- แก้ไข
/opt/apigee/customer/application/zookeeper.properties
เพื่อตั้งค่าพร็อพเพอร์ตี้ต่อไปนี้ หากยังไม่มี ให้สร้างไฟล์ดังกล่าว - ตั้งค่าพร็อพเพอร์ตี้ต่อไปนี้ใน
zookeeper.properties
# Set the snapshot count. In this example set it to 10: conf_zoo_autopurge.snapretaincount=10 # Set the purge interval. In this example, set is to 240 hours: conf_zoo_autopurge.purgeinterval=240
- ตรวจสอบว่าไฟล์เป็นของผู้ใช้ "apigee":
chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
- รีสตาร์ท ZooKeeper โดยใช้คำสั่งต่อไปนี้
/opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart
การบำรุงรักษาไฟล์บันทึก
ไฟล์บันทึก Apache Zookeeper จะเก็บไว้ใน /opt/apigee/var/log/apache-zookeeper
โดยปกติแล้ว คุณไม่จำเป็นต้องบำรุงรักษาไฟล์บันทึก แต่หากพบว่ามีบันทึก ZooKeeper มากเกินไปหรือบันทึกมีขนาดใหญ่มาก คุณจะแก้ไขพร็อพเพอร์ตี้ log4j ของ ZooKeeper เพื่อกำหนดขนาดไฟล์และจำนวนไฟล์สูงสุดได้
- แก้ไข
/opt/apigee/customer/application/zookeeper.properties
เพื่อตั้งค่าพร็อพเพอร์ตี้ต่อไปนี้ หากยังไม่มี ให้สร้างไฟล์ดังกล่าว - ตั้งค่าพร็อพเพอร์ตี้ต่อไปนี้ใน
zookeeper.properties
conf_log4j_log4j.appender.rollingfile.maxfilesize=10MB # max file size conf_log4j_log4j.appender.rollingfile.maxbackupindex=50 # max open files
- ตรวจสอบว่าไฟล์เป็นของผู้ใช้ "apigee":
chown apigee:apigee /opt/apigee/customer/application/zookeeper.properties
- รีสตาร์ท ZooKeeper โดยใช้คำสั่งต่อไปนี้
/opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restart