03_Elastic部署
ES集群部署
elastic不能用root用户去启动,否则会报错,所以创建elastic用户
1.创建elastic用户
$ useradd elastic -s /sbin/nologin
2..部署JDK环境
根据01_环境说明中安装即可
3.下载elastic源码包
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.0.tar.gz
4.解压elastic
$ tar xvf elasticsearch-6.6.0.tar.gz -C /usr/local/
$ mv /usr/local/elasticsearch-6.6.0/ /usr/local/elastic
$ chown -R elastic /usr/local/elastic/
5.修改elastic内存配置
elasticsearch6.6.0默认内存需要1G,如果没有1G内存可能会报错,如果内存不够则需要修改配置文件
$ vim /usr/local/elastic/config/jvm.options
-Xms512m
-Xmx512m
6.修改elastic配置文件
$ mkdir /data/es-data -p
$ mkdir /var/log/elastic/
$ vim /usr/local/elastic/config/elasticsearch.yml
# 组名自定义,但是同一个组,组名必须一致
cluster.name: my-application
# 节点名称,建议和主机名一致
node.name: elastic
# 数据存放目录
path.data: /data/es-data
# 日志存放路径
path.logs: /var/log/elastic
# 锁住内存,bubei 使用到交换分区去
bootstrap.memory_lock: true
# 由于只部署两个节点,因此设置为1,否则当master宕机,将无法重新选取master
# discovery.zen.minimum_master_nodes: 1
# 网络设置
network.host: 0.0.0.0
# 端口
http.port: 9200
# 从节点配置
# 关闭多播
discovery.zen.ping.unicast.enabled: false
# 发单播,如果是两台es,就是两个es的IP
discovery.zen.ping.unicast.hosts: ["172.16.142.141"]
6.启动elastic
$ chown -R elastic /data/
$ chown -R elastic /var/log/elastic/
$ su - elastic -s /bin/bash
$ /usr/local/elastic/bin/elasticsearch -d
-d 后台启动
7.测试

8.报错

[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536] #切换回root
$ vim /etc/security/limits.conf
# elastic是用户
elastic soft nofile 65536
elastic hard nofile 65536
# 登录elastic查看
$ ulimit -Hn
65536
[2]: memory locking requested for elasticsearch process but memory is not locked $ vim /etc/security/limits.conf
elastic - memlock unlimited
[3]: max number of threads [3802] for user [elastic] is too low, increase to at least [4096] $ vim /etc/security/limits.d/20-nproc.conf
elastic - nproc 4096
[4]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] $ vim /etc/sysctl.conf
vm.max_map_count=655360
$ sysctl -p
head插件安装(可不安装)
elastic5.0之后,head插件需要独立安装
1.head插件
# 安装NodeJS
$ wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.5.0-linux-x64.tar.gz
$ tar -zxvf node-v4.5.0-linux-x64.tar.gz -C /usr/local/
$ mv /usr/local/node-v4.5.0-linux-x64 /usr/local/node
$ vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin/
export NODE_PATH=$NODE_HOME/lib/node_modules
$ source /etc/profile
# 安装npm
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
# 安装grunt
$ npm install -g grunt
$ npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
# 确认版本
$ node -v
v9.5.0
$ npm -v
5.6.0
$ grunt -version
grunt-cli v1.3.2
grunt v1.0.1
$ wget https://github.com/mobz/elasticsearch-head/archive/master.zip
$ unzip master.zip
$ cd elasticsearch-head-master/
# npm install -g cnpm --registry=https://registry.npm.taobao.org
$ npm install
# 修改es的配置文件
# head插件可以访问es
$ vim /usr/local/elastic/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
# 修改head插件配置文件
$ vim Gruntfile.js
# 增加一行hostname
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
$ vim elasticsearch-head-master/_site/app.js
# 修改localhost为es的ip地址
# this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.126:9200";
# 重启es
$ grunt server

03_Elastic部署的更多相关文章
- [原]CentOS7.2部署node-mapnik
转载请注明表作者think8848及出处(http://think8848.cnblogs.com) node-mapnik依赖项中要求g++ >= 5, toolchain (>= GL ...
- 使用Visual Studio 2015 开发ASP.NET MVC 5 项目部署到Mono/Jexus
最新的Mono 4.4已经支持运行asp.net mvc5项目,有的同学听了这句话就兴高采烈的拿起Visual Studio 2015创建了一个mvc 5的项目,然后部署到Mono上,浏览下发现一堆错 ...
- 通过Jexus 部署 dotnetcore版本MusicStore 示例程序
ASPNET Music Store application 是一个展示最新的.NET 平台(包括.NET Core/Mono等)上使用MVC 和Entity Framework的示例程序,本文将展示 ...
- 结合Jexus + Kestrel 部署 asp.net core 生产环境
ASP.NET Core 是微软的全新的框架.这一框架的目标 ︰ 跨平台 针对云应用优化 解除 System.Web 的依赖. 获得下面三个方面的优势,你可以把它认为是一个C# 版本的NodeJS: ...
- 4.Windows Server2012 R2里面部署 MVC 的网站
网站部署之~Windows Server | 本地部署:http://www.cnblogs.com/dunitian/p/4822808.html#iis 后期会在博客首发更新:http://dnt ...
- Win10 IIS本地部署MVC网站时不能运行?
异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 部署后出现这个错误: 打开文件目录后发现是可以看见目录的,静态页面也是可以打开的 ...
- 再部署一个 instance 和 Local Network - 每天5分钟玩转 OpenStack(131)
上一节部署了 cirros-vm1 到 first_local_net,今天我们将再部署 cirros-vm2 到同一网络,并创建 second_local_net. 连接第二个 instance 到 ...
- 将 instance 部署到 OVS Local Network - 每天5分钟玩转 OpenStack(130)
上一节创建了 OVS 本地网络 first_local_net,今天我们会部署一个 instance 到该网络并分析网络结构.launch 一个 instance,选择 first_local_net ...
- 从零开始编写自己的C#框架(25)——网站部署
导航 1.关掉访问保护 2.发布网站 3.复制网站到服务器 4.添加新网站 5.设置网站访问权限 6.设置文件夹访问权限 7.控制可更新文件夹执行权限 8.设置“应用程序池”.net版本与模式 9.附 ...
随机推荐
- sqlserver exists 与 in 的区别
使用 EXISTS 方式 select * from A a where EXISTS(select b.mainInfoId from B b where b.mainInfoId=a.main ...
- C#简单工厂案例
using System; namespace Application { class JianDanGongChang { static void Main(string[] args) { Fac ...
- linux的scp命令可以在linux服务器之间复制文件和目录
scp是secure copy的简写,用于在Linux下进行远程拷贝文件的命令,和它类似的命令有cp,不过cp只是在本机进行拷贝不能跨服务器,而且scp传输是加密的.可能会稍微影响一下速度.当你服务器 ...
- Ubuntu install android studio
Ubuntu install android studio 1. 安装 openjdk8,并在配置文件 /etc/profile 中,追加如下内容: sudo aptitude install ope ...
- [转载]Python 包管理工具
[转载]Python 包管理工具 最近由于机缘巧合,使用各种方法安装了一些Python包,所以对Python的包管理开始感兴趣.在网上找到一篇很好的文章:https://blog.zengrong.n ...
- Jerry带您了解Restful ABAP Programming模型系列之二:Action和Validation的实现
相信通过Jerry的前一篇文章 30分钟用Restful ABAP Programming模型开发一个支持增删改查的Fiori应用,想必大家对Restful ABAP Programming模型已经有 ...
- 网络编程socketserver
一.网络编程回顾 tcp是流式传输,字节流,数据与数据之间没有边界 优点:不限定长度,可靠传输 缺点:慢,和一端的通信连接conn会一直占用通信资源 udp协议式面向数据包的传输 优点:快,由于不需要 ...
- 阿里云ECS配置JDK和tomcat
一.配置JDK 1.利用Xftp连接ECS 2.新建文件夹 在ECS上新建一个放压缩包的文件夹,便于整理 (此处也可以在xshell中利用代码新建mkdir /home/temp) 3.将下载好的JD ...
- LInux CentOS7 vsftpd 配置注释
本文首发: https://www.somata.work/2019/LinuxCentOSvsftpdConfigComment.html vsftpd.conf anonymous_enable= ...
- Python使用jieba分词
# -*- coding: utf-8 -*- # Spyder (python 3.7) import pandas as pd import jieba import jieba.analyse ...