ubuntu搭建elasticsearch

作者: sunnnnnnnnnny | 来源:发表于2020-03-19 08:51 被阅读0次

环境

虚拟机环境配置

安装vmware12pro
创建虚拟机ubuntu16.04 ubuntu(root)/123456
更新源
https://cloud.tencent.com/developer/article/1135529

安装java8

https://www.cnblogs.com/guxiaobei/p/8556586.html

sudo apt-get install default-jre

安装elasticsearch

使用apt方式安装elaticsearch6.8方便快捷
https://www.elastic.co/guide/en/elasticsearch/reference/6.8/install-elasticsearch.html

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install elasticsearch

配置elasticsearch

注意:配置es需要切换到root用户,启动es不需要root用户
配置文件目录 /etc/elasticsearch YAML格式

  • elasticsearch.yml for configuring Elasticsearch
  • jvm.options for configuring Elasticsearch JVM settings
  • log4j2.properties for configuring Elasticsearch logging

设置jvm选项 /etc/elasticsearch/jvm.options

#堆大小 
-Xms2g 最小堆大小
-Xmx2g 最大堆大小

重要的配置项
/etc/elasticsearch/elasticsearch.yml

path.data 数据文件
path.logs 日志文件
cluster.name 集群名称,一个集群对应多个Node
node.name 节点名称 
network.host 绑定的IP地址默认为127.0.0.0

设置开机自启动

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

启动和关闭

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

https://www.elastic.co/guide/en/elasticsearch/reference/6.8/deb.html
使用curl测试是否装好

ubuntu@ubuntu:/etc/elasticsearch$ curl localhost:9200
{
  "name" : "kQOogOX",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "GZ5rMOMgRtqJewDPOscF_w",
  "version" : {
    "number" : "6.8.7",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "c63e621",
    "build_date" : "2020-02-26T14:38:01.193138Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.2",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

注意问题

导入ovf模板时,需要修改硬件兼容性,在虚拟机->管理->修改硬件兼容性中修改,使得导出的ovf文件兼容目标ESXI系统

参考资料

https://www.freebuf.com/sectool/183984.html
https://github.com/aol/moloch
https://molo.ch/#downloads
https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html

相关文章

网友评论

    本文标题:ubuntu搭建elasticsearch

    本文链接:https://www.haomeiwen.com/subject/joezehtx.html