เข้าถึง Elasticsearch API
- URL:
http://<server-ip>:9200 - การสื่อสารคลัสเตอร์ภายใน:
127.0.0.1:9300(อย่าเปิดเผยภายนอก)
ข้อมูลรับรอง
- ผู้ใช้:
elastic - รหัสผ่าน: เก็บไว้อย่างปลอดภัยใน
/root/.cloudzy-creds
ไดเรกทอรีที่สำคัญ
- กำหนดค่า:
/etc/elasticsearch - ข้อมูล:
/var/lib/elasticsearch - บันทึก:
/var/log/elasticsearch - ไบนารี:
/usr/share/elasticsearch/bin - ปลั๊กอิน:
/usr/share/elasticsearch/plugins
การจัดการบริการ
ใช้ systemctl คำสั่ง:
systemctl status elasticsearch systemctl restart elasticsearch systemctl stop elasticsearch systemctl start elasticsearch
การลงทะเบียน Kibana (ไม่บังคับ)
หากคุณวางแผนที่จะติดตั้ง Kibana แยกต่างหาก คุณจะต้องสร้างโทเค็นการลงทะเบียนบน Elasticsearch และใช้เพื่อกำหนดค่า Kibana อย่างปลอดภัย
1. สร้างโทเค็นการลงทะเบียนบนเซิร์ฟเวอร์ Elasticsearch:
/usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
2. คัดลอกโทเค็นที่สร้างขึ้นและเรียกใช้เซิร์ฟเวอร์ Kibana:
/usr/share/kibana/bin/kibana-setup --enrollment-token "<your-token>"
การดำเนินการนี้จะลงทะเบียน Kibana ด้วย Elasticsearch อย่างปลอดภัย
ตัวอย่างคำสั่ง Elasticsearch
ตรวจสอบความสมบูรณ์ของคลัสเตอร์:
curl -X GET -k "https://localhost:9200/_cluster/health?pretty" -u elastic:<password> --cacert /etc/elasticsearch/certs/http_ca.crt
แสดงรายการดัชนีทั้งหมด:
curl -X GET -k "https://localhost:9200/_cat/indices?v" -u elastic:<password> --cacert /etc/elasticsearch/certs/http_ca.crt