码迷,mamicode.com
首页 > 系统相关 > 详细

ElasticSearch部署文档(Ubuntu 14.04)

时间:2016-08-24 01:03:12      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:

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

 

安装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部署文档(Ubuntu 14.04)

标签:

原文地址:http://www.cnblogs.com/zxh930508/p/5801239.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!