Let’s download the elasticsearch-7.1.1-darwin-x86_64.tar.gznode
as follows:linux
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-darwin-x86_64.tar.gz
Then extract it as follows:(而后解压)bootstrap
tar -xzf elasticsearch-7.1.1-darwin-x86_64.tar.gz
It will then create a bunch of files and folders in your current directory. We then go into the bin directory as follows:(进入bin 目录)vim
cd elasticsearch-7.1.1/bin
And now we are ready to start our node and single cluster:(启动程序)浏览器
./elasticsearch
-d
./elasticsearch -d
测试 Elasticsearch 是否启动成功,能够打开另外一个终端,执行如下操做:安全
curl 'http://localhost:9200/?pretty'
注意事项:
1. elasticsearch 是不能用root 用户启动的,(缘由:因为Elasticsearch能够输入且执行脚本,为了系统安全,不容许使用root启动;咱们看看有没有可用的用户),因此要用一个权限不是root的用户启动
//添加分组 deng
groupadd deng服务器
//添加用户xing,分组在deng,密码xing123
useradd xing -g deng -p xing123
//受权 elasticsearch-7.1.1目录下的文件拥有者为 xing(用户):deng(分组)
chown -R xing:deng elasticsearch-7.1.1
切换用户: su xing 而后启动 ./bin/elasticsearchcurl
端口号放开和host 修改:jvm
jvm.options 中默认配置修改成:
运行 elasticsearch
./bin/elasticsearch -d 后台启动
*. 解决 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
缘由:max_map_count这个参数就是容许一个进程在VMAs(虚拟内存区域)拥有最大数量,VMA是一个连续的虚拟地址空间,当进程建立一个内存映像文件时VMA的地址空间就会增长,当达到max_map_count了就是返回out of memory errors。
出现这个问题,咱们须要切换到root用户下
// 修改下面的文件 里面是一些内核参数
vi /etc/sysctl.conf
//添加如下配置
vm.max_map_count=655360
添加完后保存,而后执行
sysctl -p
//-p 从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载
* 解决 max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
缘由:最大文件打开数量过小,出现此错误,切换到root用户下,修改limits.conf
// 编辑此文件
[root@izbp163wlhi02tcaxyuxb7z /]# vim etc/security/limits.conf
在文件后加上
* soft nofile 65536
* hard nofile 65536
进入 /etc/security/limits.d 这个目录下, 修改 vim 20-nproc.conf 文件
问题: ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
这时候编辑elasticsearch.yml文件,将 #cluster.initial_master_nodes: ["node-1", "node-2"] 修改成 cluster.initial_master_nodes: ["node-1"],保存。
测试 Elasticsearch 是否启动成功,能够打开另外一个终端,执行如下操做:
curl 'http://localhost:9200/?pretty'
咱们须要在后台启动,这样当咱们退出时,应用仍在后台运行
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ ./bin/elasticsearch -d
中止后台服务
前台启动,直接ctrl+c退出便可,后台启动,中止时能够直接杀掉进程
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ jps
32644 Elasticsearch
1206 Jps
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ kill -9 32644
[xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$
总结:
1. 官方地址:https://www.elastic.co/downloads/past-releases 我这里安装在linux环境,下载tar包,下载完后解压: tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz 2. 在 config目录下 vim jvm.options 修改 将 -Xms2g -Xmx2g 改成 -Xms512m -Xmx512m 3. 添加权限 //添加分组 deng groupadd deng //添加用户xing,分组在deng,密码xing123 useradd xing -g deng -p xing123 //受权 /elasticsearch 目录下的文件拥有者为 xing(用户):deng(分组) chown -R xing:deng elasticsearch/ 4. 开放端口和绑定地址 vim elasticsearch.yml 将network.host放开,修改成0.0.0.0下,将http.port放开,以下: # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 network.host: 0.0.0.0 # # Set a custom port for HTTP: # http.port: 9200 # # For more information, consult the network module documentation. 5. 修改配置参数 5.1 // 修改下面的文件 里面是一些内核参数 vi /etc/sysctl.conf //添加如下配置 vm.max_map_count=655360 添加完后保存,而后执行 sysctl -p //-p 从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载 5.2 / 编辑此文件 [root@izbp163wlhi02tcaxyuxb7z /]# vim etc/security/limits.conf 在文件后加上 * soft nofile 65536 * hard nofile 65536 5.5.3版本,此文件有这几个值,咱们只须要把这几个值从65535改成65536便可。 # End of file root soft nofile 65536 root hard nofile 65536 * soft nofile 65536 * hard nofile 65536 6. 后台启动Elasticsearch 切换到xing 用户下启动(root 用户不能启动) [root@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]# su xing [xing@izuf6ezkmfgg9r7jkfcp3oz elasticsearch-7.1.1]$ ./bin/elasticsearch -d 关闭 中止后台服务 前台启动,直接ctrl+c退出便可,后台启动,中止时能够直接杀掉进程 [wang@izbp163wlhi02tcaxyuxb7z bin]$ ./elasticsearch -d [wang@izbp163wlhi02tcaxyuxb7z bin]$ jps 3697 Elasticsearch 3771 Jps [wang@izbp163wlhi02tcaxyuxb7z bin]$ kill -9 3697
2. 安装kibana
每个版本的es都有一个对应的Kibana版本,咱们能够去下面的地址查找最新的版本,建议和es相同版本;
下载地址:https://www.elastic.co/downloads/past-releases
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.1.1-linux-x86_64.tar.gz
//解压:
tar -zxvf kibana-7.1.1-linux-x86_64.tar.gz
启动: ./bin/kibana
kibana默认是在前台启动,能够经过ctrl+c命令中止。
他会默认去连接同一台服务器上的9200端口提供的服务,若是没有启动elasticSearch服务,他会一直尝试去链接,咱们启动下elasticSearch
1. 修改配置开放端口
咱们放开端口,放开server.host,并修改以下:
server.port: 5601
server.host: 0.0.0.0
2. kibana后台启动
当使用前台启动时,若是咱们退出终端,服务就会中止,咱们可使用nohup命令来启动;
[root@izbp163wlhi02tcaxyuxb7z kibana-5.5.3-linux-x86_64]# nohup ./bin/kibana &
nohup命令:若是你在运行一个进程,你但愿在退出帐户或者关闭终端时继续运行相应的进程,就可使用nohup(no hang up);该命令格式为:nohup command &
暂停:
ps -ef | grep kibana
或者 ps -ef | grep 5601
或者 ps -ef | grep node
而后 kill -9 29063 就能够暂停kibana
浏览器访问为:http://ip:5601/ 就看到以下界面了
安装完成