hadoop2-elasticsearch的安装

本文主要讲elasticsearch-2.2.1的安装过程。

准备工作:

1.搭建虚拟机

你需要先参考

hadoop2集群环境搭建

设置您的虚拟机-您不必构建Hadoop环境(完成步骤1到8)

[En]

Set up your virtual machine-you don’t have to build a hadoop environment ( * complete steps 1 to 8 )*

2.下载elasticsearch包

下载elasticsearch-2.2.1.tar.zip

在这里,我构建了4个虚拟机(node1、node2、node3、node4)

[En]

Here I build 4 virtual machines (node1,node2,node3,node4)

elasticsearch 只允许普通用户操作,不允许root用户操作

--1.关闭防火墙
service iptables stop

--2.创建用户elsearch
useradd elsearch
--3.给用户elsearch设置密码
passwd elsearch

--4.在/opt目录下面创建elsearch/es/目录
mkdir /opt/elsearch/es/

--5.进入到/opt目录下面
cd /opt/

--6.把elsearch目录以及里面的子目录的权限设置为elsearch
chown -R elsearch:elsearch elsearch

--此时,/elsearch, /elsearch/es的权限都应该为elsearch

--7.切换用户到elsearch
su elsearch

此时,所有节点都应该是elearch用户,而不是根用户。

[En]

At this point, all nodes should be elsearch users, not root users.

现在去到node1节点上面进行操作

--此时,在node1上面操作
--1.此时,我们就可以把下载好的elasticsearch-2.2.1.tar.zip文件上传到node1下面的/opt/elsearch/es/
--2.解压/opt/elsearch/es/elasticsearch-2.2.1.tar.zip文件
cd /opt/elsearch/es/
unzip elasticsearch-2.2.1.tar.zip

--3.修改配置文件
cd /opt/elsearch/es/elasticsearch-2.2.1/conf/

vi elasticsearch.yml

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.

#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.

#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.

#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: elsearch-app
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the ES_HEAP_SIZE environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.

#
# Elasticsearch performs poorly when the system is swapping the memory.

#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.79.138
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.79.138","192.168.79.139", "192.168.79.140","192.168.79.141"]
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s

:wq

--4.然后从node1分发到其他节点(node2, node3, node4)的相同目录
cd /opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node2:/opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node3:/opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node4:/opt/elsearch/es

接下来在node2,node3,node4上面进行操作

--分别修改node2,node3,node4上面的配置文件
cd /opt/elsearch/es/elasticsearch-2.2.1/conf/

vi elasticsearch.yml

--修改两个地方
--1.node.name: node1
--2.network.host: 192.168.79.138

--修改为和下面相对应,然后保存
192.168.79.138 node1
192.168.79.139 node2
192.168.79.140 node3
192.168.79.141 node4

最后,在所有节点(node1、node2、node3、node4)上运行

[En]

Finally, operate on all nodes (node1,node2,node3,node4)

--启动elasticsearch
cd /opt/elsearch/es/elasticsearch-2.2.1/bin
./elasticsearch

打开浏览器并输入:node1:9200以查看效果

[En]

Open the browser and type: node1:9200 to see the effect

hadoop2-elasticsearch的安装

添加插件elasticsearch-head

下载 elasticsearch-head

将下载的插件重命名为

[En]

Rename the downloaded plug-in to

head

然后添加到所有节点(节点1、节点2、节点3、节点4)

[En]

Then add to all nodes (node1,node2,node3,node4)

/opt/elsearch/es/elasticsearch-2.2.1/plugins

目录。

然后重新启动所有节点。

[En]

Then restart all nodes.

--启动elasticsearch
cd /opt/elsearch/es/elasticsearch-2.2.1/bin
./elasticsearch

效果如下:

hadoop2-elasticsearch的安装

了解更多:elasticsearch-head

========================================================

More reading,and english is important.

I’m Hongten

hadoop2-elasticsearch的安装
大哥大姐,我觉得奖励你们是很有用的。你们的支持是我最大的动力。谢谢。红腾博客排名不到100位。有成千上万的粉丝。鸿腾产品必须是高品质的产品。<details><summary>*<font color='gray'>[En]</font>*</summary>*<font color='gray'>Big brother and sister, I think it's useful to reward you. Your support is my biggest motivation. Thank you. Hongten blogs rank less than 100th. There are thousands of fans. Hongten products must be high-quality products.</font>*</details>

E | hongtenzone@foxmail.com B |http://www.cnblogs.com/hongten

========================================================

Original: https://www.cnblogs.com/hongten/p/hongten_hadoop_elastic_search.html
Author: Hongten
Title: hadoop2-elasticsearch的安装

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/7168/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

免费咨询
免费咨询
扫码关注
扫码关注
联系站长

站长Johngo!

大数据和算法重度研究者!

持续产出大数据、算法、LeetCode干货,以及业界好资源!

2022012703491714

微信来撩,免费咨询:xiaozhu_tec

分享本页
返回顶部