时间:2023-12-04 11:24:02 | 来源:网站运营
时间:2023-12-04 11:24:02 来源:网站运营
如何去搭建一个简单的elasticsearch搜索项目?:sudo vi /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
// 下载安装包wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_centos7.0_x86_64.rpm// 安装ossfssudo yum install ossfs_1.80.6_centos7.0_x86_64.rpm
// 将Bucket名称以及具有该Bucket访问权限的AccessKey ID和AccessKey Secret信息存放在/etc/passwd-ossfs文件中echo BucketName:yourAccessKeyId:yourAccessKeySecret > /etc/passwd-ossfs // 文件的权限建议设置为640chmod 640 /etc/passwd-ossfs// 创建本地挂载路径mkdir ./elasticsearch/data// 将oss映射到本地ossfs BucketName ./elasticsearch/data -o url=http://oss-cn-hangzhou.aliyuncs.com -oallow_other
sudo vi /etc/init.d/ossfs
填入如下内容#! /bin/bash## ossfs Automount Aliyun OSS Bucket in the specified direcotry.## chkconfig: 2345 90 10# description: Activates/Deactivates ossfs configured to start at boot time.ossfs BucketName ./elasticsearch/data -o url=http://oss-cn-hangzhou.aliyuncs.com -oallow_other
设置开机启动// 把新建立的ossfs脚本赋予可执行权限。chmod a+x /etc/init.d/ossfs// 把ossfs启动脚本作为其他服务,开机自动启动。chkconfig ossfs on
// 在运行容器并且把容器里的配置cp到宿主机当中docker run --name elk sebp/elkdocker cp -a elk:/opt/kibana/config/kibana.yml ./kibanadocker cp -a elk:/opt/logstash/config ./logstash/config//然后删除刚才创建的容器docker stop -f elkdocker rm -f elk
version: '3'services: elk: image: sebp/elk container_name: elk restart: always ports: - "5601:5601" - "9200:9200" - "5044:5044" volumes: - /opt/docker/elk/elasticsearch/data:/var/lib/elasticsearch - /opt/docker/elk/logstash/conf.d:/etc/logstash/conf.d - /opt/docker/elk/logstash/config:/opt/logstash/config - /opt/docker/elk/kibana/kibana.yml:/opt/kibana/config/kibana.yml networks: - elk_net environment: - TZ=Asia/Shanghainetworks: elk_net: external: true
vi ./logstash/conf.d/yourconfigname.conf
input { beats { port => 5044 }}output { stdout { codec => rubydebug } elasticsearch { hosts => ["http://localhost:9200"] index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}" }}
vi ./kibana/kibana.yml
i18n.locale: "zh-CN"
docker-compose -f ./docker-compose.yml up -d
启动完成后访问 http://ip:5601关键词:项目,简单