Elasticsearch elasticvue on CentOS7
2 min read

Elasticsearch elasticvue on CentOS7

elasticvue คือ โปรแกรมสำหรับ manage elasticsearch แบบ UI

  1. Install Yarn โดยใช้คำสั่งนี้

curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
yum clean all && sudo yum makecache fast
yum install -y gcc-c++ make
yum install -y nodejs

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg

yum install yarn

2. Download  elasticvue ลงเครื่อง

โหลด elasticvue ลงเครื่อง โดยใช้คำสั่งต่อไปนี้

mkdir -p /var/www
git clone https://github.com/cars10/elasticvue.git /var/www/elasticvue

3. Install elasticvue

ไปที่ directory ที่โหลดลงมา ในที่นี้คือ /var/www/elasticvue

cd /var/www/elasticvue

yarn install

yarn build

install nginx
cp /var/www/elasticvue/nginx/elasticvue.conf /etc/nginx/conf.d/
vim /etc/nginx/conf.d/elasticvue.conf

server {
listen 8080;
server_name 172.30.13.201;
root /var/www/elasticvue/dist;

access_log off;

location / {
try_files $uri $uri/ /index.html?$args;
}
}

chown -R nginx:nginx /var/www/elasticvue/
nginx -t

5. config elasticvue เชื่อมต่อกับ elasticsearch

/etc/elasticsearch/elasticsearch.yml

ใส่ไว้ที่ท้ายไฟล์ เครื่องที่เป็น master-node ทุกเครื่อง หรือเครื่องที่ต้องการให้เข้าถึง

##Config elasticvue
http.cors.enabled: true
http.cors.allow-origin: "http://ip-address:8080"
http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length,Authorization

6. สั่ง restart elasticsearch and nginx

systemctl restart elasticsearch

systemctl restart nginx

จากนั้นเข้า url http://ip-or-domain:8080