设为首页 收藏本站
查看: 1490|回复: 0

[经验分享] es+kibana

[复制链接]

尚未签到

发表于 2019-1-29 13:58:32 | 显示全部楼层 |阅读模式

  •   安装es
  检查java版本,需要1.8.0以上
  java -version
  下载安装包
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.2.tar.gz  解压
tar -xvf elasticsearch-6.1.2.tar.gz  添加用户并设置密码,并赋予权限
groupadd es
useradd -g es es
echo "123456"|passwd es --stdin
chown -R es.es /usr/local/elasticsearch-6.1.2  修改内核参数
  vim /etc/security/limits.conf
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard nproc 4096
es soft memlock unlimited
es hard memlock unlimited  运行(es禁止使用root用户运行)
su - es
cd  /usr/local/
cd elasticsearch-6.1.2/bin
./elasticsearch -d  -d选项是在后台运行程序
  访问测试
  curl localhost:9200
  ## 搭建es集群
  官方配置文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/modules.html
  复制文件
su - root
cd /usr/local
mv elasticsearch-6.1.2 elasticsearch-6-node1
cp -r elasticsearch-6-node1/ elasticsearch-6-node3
chown es.es -R elasticsearch-6-node3/
scp -r elasticsearch-6-node1/ kibana:/usr/local/elasticsearch-6.1.2/

  •   修改node1配置文件
cd /usr/local/elasticsearch-6-node1/config/
vim elasticsearch.ymlcluster.name: my-es
node.name: es-node-1
node.master: true
node.data: true
node.ingest: true
search.remote.connect: true
node.attr.rack: region1
path.data: /usr/local/elasticsearch-6-node1/data
path.logs: /usr/local/elasticsearch-6-node1/logs
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.3.161
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es", "kibana", "es:9301"]
discovery.zen.ping_timeout: 40s
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 3
action.destructive_requires_name: true  配置文件中又详细的英文介绍,想配置更多参数请看官方文档
  设置jvm
vim jvm.options-Xms4g
-Xmx4g
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+AlwaysPreTouch
-server
-Xss1m
-Djava.awt.headless=true
-Dfile.encoding=UTF-8
-Djna.nosys=true
-XX:-OmitStackTraceInFastThrow
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true
-XX:+HeapDumpOnOutOfMemoryError
#"以下日志为调试使用,过多"
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintGCDateStamps
-XX:+PrintClassHistogram
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=12
-XX:GCLogFileSize=64M
#"以上日志为调试使用,过多"  创建文件存放路径
mkdir -pv /usr/local/elasticsearch-6-node2/HeapDump
mkdir -pv /usr/local/elasticsearch-6-node2/gc

  •   修改node2配置文件
vim /usr/local/elasticsearch-6-node2/config/elasticsearch.ymlcluster.name: my-es
node.name: es-node-2
node.master: true
node.data: true
node.ingest: true
search.remote.connect: true
node.attr.rack: region1
path.data: /usr/local/elasticsearch-6-node2/data/
path.logs: /usr/local/elasticsearch-6-node2/logs/
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.3.162
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es", "kibana", "es:9301"]
discovery.zen.ping_timeout: 40s
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 3
action.destructive_requires_name: true vim jvm.options-Xms4g
-Xmx4g

  •   修改node3配置文件
      
  
vim /usr/local/elasticsearch-6-node3/config/elasticsearch.ymlcluster.name: my-es
node.name: es-node-3
node.master: true
node.data: true
node.ingest: true
search.remote.connect: true
node.attr.rack: region1
path.data: /usr/local/elasticsearch-6-node3/data/
path.logs: /usr/local/elasticsearch-6-node3/logs/
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.3.161
http.port: 9400
transport.tcp.port: 9301
discovery.zen.ping.unicast.hosts: ["es", "kibana", "es:9301"]
discovery.zen.ping_timeout: 40s
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 3
action.destructive_requires_name: true vim jvm.options-Xms4g
-Xmx4g

  •   安装kibana
  官方文档:https://www.elastic.co/guide/en/kibana/current/index.html
  (官网还有一个darwin的版本,不知道具体用处)
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.1.2-linux-x86_64.tar.gz
tar axf kibana-6.1.2-linux-x86_64.tar.gz
cd kibana-6.1.2-linux-x86_64/bin/  设置环境变量
  vim /etc/profile
export KIBANA_HOME=/usr/local/kibana-6.1.2-linux-x86_64
export PATH=${PATH}:${KIBANA_HOME}/bin  source /etc/profile
  修改配置
cd /usr/local/kibana-6.1.2-linux-x86_64/config
vim kibana.ymlserver.port: 5601
server.host: 0.0.0.0
server.maxPayloadBytes: 1048576
server.name: "kibana"
elasticsearch.url: "http://192.168.3.161:9200"
elasticsearch.preserveHost: true
elasticsearch.requestTimeout: 30000  启动kibana

cd kibana-6.1.2-linux-x86_64/bin
./kibana -c ../config/kibana.yml

  •   安装elasticsearch-head
  root安装 npm
yum install -y npm git
yum install -y nodejs-grunt-cli  es用户安装elasticsearch-head(有报错就假装看不见)
su - es
git clone git://github.com/mobz/elasticsearch-head.git
elasticsearch-head/
npm install
grunt server  检查9100端口是否监听
ss -tunlp|grep 9100
curl http://192.168.3.54:9100  连接elasticsearch(与web页面访问地址一致)


  •   报错处理
  ERROR: [3] bootstrap checks failed
  [1]: max number of threads [2048] for user [es] is too low, increase to at least [4096]
  [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  [3]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
  第一个threads太小,解决方法如下
  vim /etc/security/limits.conf
  es soft nproc 4096
  es hard nproc 4096
  第二个是vm.max_map_count太小,解决方法如下
  vi /etc/sysctl.conf
  vm.max_map_count=655360
  sysctl -p
  第三个是centos6版本不支持,修改elasticsearch.yml
  vim elasticsearch.yml
  bootstrap.memory_lock: false
  bootstrap.system_call_filter: false

  •   报错
  failed to send join request to master
  无法加入集群,网上有说是数据问题,也有说是网络问题,我遇到的是网络问题
  检查配置文件中discovery.zen.ping.unicast.hosts:是否设置正确、设置discovery.zen.ping_timeout:为更大值(默认3s),检查防火墙是否拦截

  •   参考文档:
  elasticsearch官方文档:https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html
  kiban官方文档:https://www.elastic.co/guide/en/kibana/current/index.html
  生产环境elasticsearch的配置建议:http://blog.csdn.net/thomas0yang/article/details/55518105
  elasticsearch5.0集群+kibana5.0+head插件插件的安装:https://www.cnblogs.com/reblue520/p/6239658.html
  Elasticsearch5.2.1集群搭建,动态加入节点,并添加监控诊断插件:http://blog.csdn.net/gamer_gyt/article/details/59077189




运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-669250-1-1.html 上篇帖子: 用Kibana和logstash快速搭建实时日志查询、收集与分析系统 下篇帖子: Heka配置讲解
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表