ES的安装

###【在多台机器上执行下面的命令】###
#es启动时需要使用非root用户,所以创建一个bigdata用户:
useradd murphy
#为bigdata用户添加密码:
echo 123456 | passwd --stdin murphy
#将murphy添加到sudoers
echo “murphy ALL = (root) NOPASSWD:ALL” | tee /etc/sudoers.d/bigdata
chmod 0440 /etc/sudoers.d/murphy
#解决sudo: sorry, you must have a tty to run sudo问题,在/etc/sudoers注释掉 Default requiretty 一行
sudo sed -i ‘s/Defaults requiretty/Defaults:bigdata !requiretty/’ /etc/sudoers
#切换用户
su - murphy

#创建一个bigdata目录
mkdir /{bigdata,data}
#给相应的目录添加权限
chown -R murphy:murphy {bigdata,data}


We recommend installing the Java 8 update 20 or later, or Java 7 update 55 or later.
Previous versions of Java 7 are known to have bugs that can cause index corruption and data loss.
Elasticsearch will refuse to start if a known-bad version of Java is used.
###【切换到murphy用户安装】###
1.安装jdk(jdk要求1.8.20或1.7.55以上)

2.上传es安装包

3.解压es
tar -zxvf elasticsearch-2.3.1.tar.gz -C /bigdata/

4.elasticsearch-2.3.1目录下创建plugins文件夹并添加权限
mkdir plugins
chown -R bigdata:bigdata plugins

5.安装plugin插件
#远程安装插件
bin/plugin install mobz/elasticsearch-head
#本地方式安装head插件
bin/plugin install file:///home/bigdata/elasticsearch-head-master.zip

4.修改配置
vi /bigdata/elasticsearch-2.3.1/config/elasticsearch.yml
#集群名称,通过组播的方式通信,通过名称判断属于哪个集群
cluster.name: bigdata
#节点名称,要唯一
node.name: es-1
#数据存放位置
path.data: /data/es/data
#日志存放位置
path.logs: /data/es/logs
#es绑定的ip地址
network.host: node01
#初始化时可进行选举的节点
discovery.zen.ping.unicast.hosts: [“node01”, “node02”, “ndoe03”]

5.使用scp拷贝到其他节点
scp -r elasticsearch-2.3.1/ hadoop02: P W D s c p − r e l a s t i c s e a r c h − 2.3.1 / h a d o o p 03 : PWD scp -r elasticsearch-2.3.1/ hadoop03: PWDscprelasticsearch2.3.1/hadoop03:PWD

6.在其他节点上修改es配置,需要修改的有node.name和network.host

7.启动es(/bigdata/elasticsearch-2.3.1/bin/elasticsearch -h查看帮助文档)
/bigdata/elasticsearch-2.3.1/bin/elasticsearch -d

8.用浏览器访问es所在机器的9200端口
http://node01:9200/
{
“name” : “es-1”,
“cluster_name” : “bigdata”,
“version” : {
“number” : “2.3.1”,
“build_hash” : “bd980929010aef404e7cb0843e61d0665269fc39”,
“build_timestamp” : “816-04-04T12:25:05Z”,
“build_snapshot” : false,
“lucene_version” : “5.5.0”
},
“tagline” : “You Know, for Search”
}

kill ps -ef | grep Elasticsearch | grep -v grep | awk '{print $2}'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以从官方网站下载Elasticsearch安装包。官网下载地址为。 2. 下载完成后,解压缩安装包。你可以使用以下命令解压缩tar.gz文件: ```shell tar -zxvf elasticsearch-7.8.1-linux-x86_64.tar.gz ``` 3. 解压缩完成后,进入解压缩后的目录,找到配置文件elasticsearch.yml。你可以使用以下命令来编辑该文件并进行配置: ```shell vim /usr/local/elasticsearch-7.13.2/config/elasticsearch.yml ``` 4. 在编辑配置文件之前,你可能需要了解一些配置选项以满足你的需求。根据你的环境和需求,修改elasticsearch.yml文件中的配置选项。 5. 当你完成了配置文件的修改后,保存并退出编辑器。 6. 现在,可以启动Elasticsearch了。你可以使用以下命令启动Elasticsearch: ```shell ./bin/elasticsearch ``` 这是一个基本的安装和启动Elasticsearch的过程。请注意,具体的步骤可能因操作系统和版本而略有不同。确保你仔细阅读官方文档以获取更详细的安装指南。 关于卸载Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以通过以下命令来查看已安装Elasticsearch软件包: ```shell dpkg -l | grep elastic ``` 2. 接下来,你可以使用以下命令查找Elasticsearch安装关联: ```shell dpkg -L elasticsearch ``` 3. 然后,使用以下命令来移除已安装Elasticsearch软件包: ```shell dpkg -P elasticsearch ``` 4. 继续使用以下命令查找未卸载的目录和文件: ```shell find ./elasticsearch | grep elasticsearch ``` 注意:根据你的环境和安装方式,可能会有其他目录和文件与Elasticsearch相关。 5. 最后,根据你的环境,使用以下命令来移除相关的目录和文件: ```shell rm -r /var/lib/elasticsearch rm /var/lib/dpkg/info/elasticsearch.* rm /etc/default/elasticsearch rm /etc/init.d/elasticsearch ``` 请根据自己的具体环境和需求来执行移除目录和文件的操作,确保操作正确无误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [一、ElasticSearch安装](https://blog.csdn.net/m0_51295655/article/details/123193074)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值