11/01/2560

การติดตั้ง Graylog สำหรับ Log Management (Elastic search Update Version) On CentOS 7

ส่วนนี้จะมาติดตั้ง ElasticSearch  Elasticsearch คืออะไร?    ก่อนจะเริ่ม Install  ElasticSearch   ให้ทำการ Install Package Java ก่อน
# yum install java
เมื่อทำการติดตั้งPackage Java เสร็จ ให้ทำการตรวจสอบ Version Java ว่าเป็นล่าสุดหรือเปล่า ด้วยคำสั่ง
# java -version
จะแสดง Detail ตามข้อมูลด้านล่าง
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

ให้ทำการ Import GPG key  สำหรับ Elastic Search ตาม command ด้านล่าง
# rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
หลังจากนั้น ให้ไปที่ไฟล์ config ใน yum.respos.d สำหรับ Install package Elastic Search ให้แก้ไขด้วย Editor ที่ถนัดโดย ใช้ nano หรือ vi ก็ได้ example
# nano /etc/yum.respos.d/elasticsearch.repo
แก้ไข ตาม ข้อมูลด้านล่าง<
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
เมื่อแก้ไขเสร็จให้ Save และหลังจากนั้น ให้ใช้ คำสั่ง yum สำหรับ Install package elasticsearch
# yum -y install elasticsearch
หลังจากนั้นให้ run command
# systemctl daemon-reload
# systemctl enable elasticsearch.service
หลังจากนั้น ไปที่ไฟล์config แล้วเปลี่ยนชื่อ Cluster เป็น graylog2 ตาม command ด้านล่าง

# nano /etc/elasticsearch/elasticsearch.yml
cluster.name: graylog2
และ ให้ ใส่ # ที่หน้าคำว่า script.disable_dynamic: true สำหรับปิดการทำงานไว้

หลังจากนั้น save แล้วทำการ restart service elasticsearch 
# systemctl restart elasticsearch.service
หลังจาก รอ Restart เสร็จ ให้ลอง test ด้วย คำสั่ง curl สำหรับ การ GET HTTP 
และจะ แสดงข้อมูลออกมา ว่าข้อมูลนั้นถูกต้องหรือไม่ ตาม ข้อมูลด้านล่าง
# curl -X GET http://localhost:9200
{
  "status" : 200,
  "name" : "Silver Fox",
  "cluster_name" : "graylog2",
  "version" : {
    "number" : "1.7.2",
    "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
    "build_timestamp" : "2015-09-14T09:49:53Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}
หลังจากนั้น ให้check status ว่า เป็นปกติไหม จะขึ้น คำว่า green คือปกติ
# curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
{
  "cluster_name" : "graylog2",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0
}


 ในบทความ ต่อไป จะเป็นนการติดตั้ง MongoDB 

Ref:http://www.kanouivirach.com/2014/04/elasticsearch-%E0%B8%84%E0%B8%B7%E0%B8%AD%E0%B8%AD%E0%B8%B0%E0%B9%84%E0%B8%A3/

ไม่มีความคิดเห็น:

แสดงความคิดเห็น