ubuntu 安装elasticsearch-编程思维

elasticsearch简介

 

 环境准备

  •   elasticsearch:7.0.0
  •   kibana          :7.0.0

 

安装
 

1.新创建普通用户

  elasticsearch不能用root账号启动,为了避免之后启动麻烦,直接创建一个用户建立一个文件夹

sudo adduser zhengyazhao

2.新建tools目录并且从官网下载压缩包

  也可以先从网上下载压缩包,然后上传到ubuntu系统当中

1.创建tools 目录
 mkdir tools
2.下载项目wget
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.0.zip

3.解压zip

unzip elasticsearch-5.4.0.zip

图中是解压完成之后的内容

 

4.修改运行内存,目前下载下来的elasticesarch运行是占用2个g

vi /config/jvm.options

 

5.设置外网访问

   如果新配置完成的话,默认只能在本机进行访问,此时我们需要修改一下配置可以让外网访问,首先需要关闭防火墙,并且在elasticsearch.yml当中添加一行network.host: 0.0.0.0

添加一行
network.host: 0.0.0.0

cluster.initial_master_nodes: ["node-1"]


#http.cors.enabled: true
#http.cors.allow-origin: "*"

 

 

 

 

 

 6.启动elasticearch,如果需要在后台运行的话加上 -d

 ./elasticsearch -d

7.关闭后台进程

ps -ef | grep elastic
根据显示的进程号:kill -9  10603(进程号)

 安装elasticsearch-head插件

  1.下载插件

wget https://codeload.github.com/mobz/elasticsearch-head/zip/master
unzip master

 2.安装nodejs 以及npm

 

sudo apt-get install nodejs

安装npm
sudo apt-get install npm

安装grunt和grunt-cli
sudo apt-get install -g grunt
sudo apt-get install -g grunt-cli

3.安装项目依赖

sudo npm install

4.启动

npm start

 5.记得要修改elasticeach当中的elasticsearch.yml配置文件,添加跨域配置

http.cors.enabled: true
http.cors.allow-origin: "*"

 

 

部署kibana

 

1.下载源文件

下载地址:wget https://artifacts.elastic.co/downloads/kibana/kibana-5.4.0-linux-x86_64.tar.gz~

2.解压

tar zxvf kibana-5.4.0-linux-x86_64.tar.gz

3.修改配置

vi kibana.yml 修改当中的server.host

 

4.启动

运   行 : ./kabana
后台运行 : ./kabana &

 5.关闭后台进程

ps -ef | grep kibana

版权声明:本文版权归作者所有,遵循 CC 4.0 BY-SA 许可协议, 转载请注明原文链接
https://www.cnblogs.com/weihengblogs/p/17030511.html