安装版本:elasticsearch-6.6.1.tar.gz
1.准备工作
安装jdk1.8
2.安装ES
(1)将安装包解压到 /opt/dp 目录下
tar -zxvf elasticsearch-6.6.1.tar.gz
(2)配置elasticsearch.yml,并创建对应的data和logs文件夹
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: es
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
# 配置单一节点名称,每个节点唯一标识
node.name: node-1
#
# Add custom attributes to the node:
#
# node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /opt/dp/elasticsearch-6.6.1/data
#
# Path to log files:
#
path.logs: /opt/dp/elasticsearch-6.6.1/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
# 端口
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 19270
transport.tcp.port: 19370
transport.tcp.compress: true
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
#
http.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
http.max_content_length: 128mb
discovery.zen.ping.unicast.hosts: ["172.17.8.27","172.17.8.28","172.17.8.35"]
discovery.zen.ping_timeout: 60s
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 60s
discovery.zen.fd.ping_retries: 6
gateway.recover_after_nodes: 3
gateway.recover_after_time: 10m
indices.queries.cache.size: 512mb
indices.memory.index_buffer_size: 5%
indices.memory.min_index_buffer_size: 256mb
#indices.memory.min_shard_index_buffer_size: 8mb
indices.requests.cache.size: 2%
#indices.recovery.concurrent_streams: 8
#indices.recovery.concurrent_small_file_streams: 4
#indices.recovery.file_chunk_size: 2mb
#indices.recovery.translog_ops: 2048
#indices.recovery.translog_size: 2mb
indices.recovery.max_bytes_per_sec: 256mb
thread_pool.bulk.queue_size: 20000
thread_pool.search.queue_size: 20000
thread_pool.get.queue_size: 20000
thread_pool.index.queue_size: 10240
(3)新建用户,每台服务器都要新建,ES不允许root用户运行
groupadd elsearch 新增elsearch用户组
useradd elsearch -g elsearch -p elasticsearch 创建elsearch用户
chown -R elsearch:elsearch ./elasticsearch-6.6.1 用户目录权限
3.切换到elsearch用户下,启动ES
su elsearch
cd /opt/dp/elasticsearch-6.6.1/bin
./elasticsearch &
4.测试,访问 http://172.17.8.27:19270/,返回结果如下
{
"name" : "node-1",
"cluster_name" : "es",
"cluster_uuid" : "HLCXHlh2TfiNj4EWPocsxQ",
"version" : {
"number" : "6.6.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1fd8f69",
"build_date" : "2019-02-13T17:10:04.160291Z",
"build_snapshot" : false,
"lucene_version" : "7.6.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
ElasticSearch-head插件安装
1.准备工作
(1)安装Node.js,用yum安装
(2)安装npm
(3)安装grunt
2.在27服务器上安装elasticsearch-head
3.修改Gruntfile.js文件
port: 19338,
hostname: '0.0.0.0',
4.启动elasticsearch-head
cd /opt/dp/elasticsearch-6.6.1/jg_dashboard/elasticsearch-head/
#!/bin/bash
nohup grunt/bin/grunt server >/dev/null &
5.浏览器访问 http://172.17.8.27:19338/
Elasticsearch.png
参考资料:
1.https://www.cnblogs.com/jstarseven/p/6803054.html
2.https://www.runoob.com/nodejs/nodejs-install-setup.html
网友评论