ElasticSearch安装部署,基本配置(Ubuntu14.04)

Posted ExplorerMan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch安装部署,基本配置(Ubuntu14.04)相关的知识,希望对你有一定的参考价值。

ElasticSearch部署文档(Ubuntu 14.04)

安装java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default  
java -version
whereis java
which java (java执行路径)
echo $JAVA_HOME

echo $PATH

 

安装ElasticSearch

wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb http://packages.elastic.co/elasticsearch/1.6/debian stable main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install elasticsearch
sudo update-rc.d elasticsearch defaults 95 10

ElasticSearch各个目录说明

typedescriptionlocation
home Home of elasticsearch installation /usr/share/elasticsearch
bin Binary scripts including elasticsearch to start a node /usr/share/elasticsearch/bin
conf Configuration files elasticsearch.yml and logging.yml /etc/elasticsearch
conf Environment variables including heap size,file descriptors /etc/default/elasticsearch
data The location of the data files /var/lib/elasticsearch/
logs Log files location /var/log/elasticsearch
plugins Plugin files location /usr/share/elasticsearch/plugins

配置

ES_HEAP_SIZE

# 在/etc/default/elasticsearch中修改:
ES_HEAP_SIZE=4g    #不要超过32g,如果整台机器只部署ES,一半内存用于Java heap,另一半给Lucene

File Descriptors

cat <<EOF>> /etc/security/limits.conf
elasticsearch - nofile 65535
EOF

# 在/etc/default/elasticsearch中修改:
MAX_OPEN_FILES=65535

Virtual memory

cat <<EOF>> /etc/sysctl.conf
vm.max_map_count=262144
EOF

sysctl -p

Memory Settings

# 在/etc/elasticsearch/elasticsearch.yml中修改:
bootstrap.mlockall: true
# 在/etc/default/elasticsearch中修改:
MAX_LOCKED_MEMORY=unlimited

其他

/etc/elasticsearch/elasticsearch.yml中修改:

# 集群名称,同一集群,名称要设置相同
cluster.name: elasticsearch_production
# 节点名称
node.name: elasticsearch_001_data

# 数据路径,可配置多个,英文逗号分开,注意目录的权限,保证elasticsearch用户可写
path.data: /path/to/data1,/path/to/data2 
# 日志路径,注意目录的权限,保证elasticsearch用户可写
path.logs: /path/to/logs
# 插件路径
path.plugins: /path/to/plugins

# 该属性是为了形成一个集群,有主节点资格并互相连接的节点的最小数目
# (number of master-eligible nodes / 2) + 1。 下面的值是在3个有主节点资格的情况下设定
# 因为节点数,以后可以增加,或者减少,故该配置可以动态修改
discovery.zen.minimum_master_nodes: 2

# 恢复控制
gateway.recover_after_nodes: 2
gateway.expected_nodes: 3
gateway.recover_after_time: 5m

#关闭多播,用单播。并指定至少一个能接受单播的主机
discovery.zen.ping.multicast.enabled: false 
discovery.zen.ping.unicast.hosts: ["192.168.2.1:9300", "192.168.2.2:9300", "192.168.2.3:9300"]

启动

sudo /etc/init.d/elasticsearch start
# 验证上面一些配置是否配置成功
curl localhost:9200/_nodes/process?pretty

参考链接

以上是关于ElasticSearch安装部署,基本配置(Ubuntu14.04)的主要内容,如果未能解决你的问题,请参考以下文章

Elasticsearch入门 简介及部署

ElasticSearch部署安装

windows 单机 - elasticsearch-7.11.1 kibana-7.11.1 安装部署

windows 单机 - elasticsearch-7.11.1 kibana-7.11.1 安装部署

2022Elasticsearch-7.17.6集群部署

Elasticsearch(ELK)集群环境部署