大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
docker pull docker.elastic.co/elasticsearch/elasticsearch:5.5.1 docker pull docker.elastic.co/kibana/kibana:5.5.1 docker pull docker.elastic.co/logstash/logstash:5.5.1123
启动Elastic Search容器:
成都做网站、网站制作的开发,更需要了解用户,从用户角度来建设网站,获得较好的用户体验。成都创新互联多年互联网经验,见的多,沟通容易、能帮助客户提出的运营建议。作为成都一家网络公司,打造的就是网站建设产品直销的概念。选择成都创新互联,不只是建站,我们把建站作为产品,不断的更新、完善,让每位来访用户感受到浩方产品的价值服务。docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" \--name my-elastic -d docker.elastic.co/elasticsearch/elasticsearch:5.5.112启动Kibana容器:
docker run -p 5601:5601 -e "ELASTICSEARCH_URL=http://localhost:9200" --name my-kibana \--network host -d docker.elastic.co/kibana/kibana:5.5.112创建logstash/logstash.yml,配置xpack对于logstash的监控:
http.host: "0.0.0.0"path.config: /usr/share/logstash/pipelinexpack.monitoring.elasticsearch.url: http://localhost:9200xpack.monitoring.elasticsearch.username: elasticxpack.monitoring.elasticsearch.password: changeme12345创建logstash/conf.d/logstash.conf,配置logstash的输入输出:
input { file { path => "/tmp/access_log" start_position => "beginning" } } output { elasticsearch { hosts => ["localhost:9200"] user => "elastic" password => "changeme" } }12345678910111213启动Logstash容器:
docker run -v /home/ubuntu/logstash/conf.d:/usr/share/logstash/pipeline/:ro -v /tmp:/tmp:ro \ -v /home/ubuntu/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml:ro --name my-logstash \ --network host -d docker.elastic.co/logstash/logstash:5.5.1123测试一下,在/tmp/access.log中添加两行信息:
echo "Hello World!" >> /tmp/access_logecho "Hello ELK!" >> /tmp/access_log12打开kibana的链接http://yourhost:5601,使用用户名/密码: elastic/changeme登录。在”Configure an index pattern”页面点击Create按钮。点击菜单Monitor即可查看ELK节点的状态
在Kibana点击Discover菜单,可以看到相关的日志信息:
Elastic官方提供了用docker-compose启动Elastic Search集群的方法,首先安装docker-compose
curl -L https://github.com/docker/compose/releases/download/1.15.0/docker-compose-Linux-x86_64 \> /usr/local/bin/docker-composesudo chmod +x /usr/local/bin/docker-composedocker-compose --version1234创建一个elasticsearch/docker-compose.yml文件:
version: '2' services: elasticsearch2: image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1 container_name: elasticsearch2 environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 mem_limit: 1g volumes: - esdata1:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - esnet elasticsearch3: image: docker.elastic.co/elasticsearch/elasticsearch:5.5.1 environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "discovery.zen.ping.unicast.hosts=elasticsearch2" ulimits: memlock: soft: -1 hard: -1 mem_limit: 1g volumes: - esdata2:/usr/share/elasticsearch/data networks: - esnetvolumes: esdata1: driver: local esdata2: driver: local networks: esnet:123456789101112131415161718192021222324252627282930313233343536373839404142434445在/etc/sysctl.conf文件中追加一行
vm.max_map_count = 2621441执行命令应用变更:
sudo sysctl -p1在docker-compose.yml所在的目录执行以下命令,启动elastic search集群:
docker stop my-elastic && docker rm my-elasticdocker-compose up &12在Kibana中Monitor菜单中可以看到,Elastic Search集群已经正常工作:
Elastic Docker Images的默认账号密码是elastic/changeme,使用默认密码是不安全的,假设要把密码改为elastic0。在Docker所在服务器上执行命令,修改用户elastic的密码:
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" \-d '{ "password" : "elastic0" }'1234设置密码,重启Kibana:
docker stop my-kibana && docker rm my-kibanadocker run -p 5601:5601 -e "ELASTICSEARCH_URL=http://localhost:9200" -e "ELASTICSEARCH_PASSWORD=elastic0" \--name my-kibana --network host -d docker.elastic.co/kibana/kibana:5.5.1123修改logstash/logstash.yml,logstash/conf.d/logstash.conf中的密码,然后重启logstash服务
docker restart my-logstash2测试一下,在/tmp/access.log中添加两行信息:
echo "Hello World!" >> /tmp/access_logecho "Hello ELK!" >> /tmp/access_log12打开kibana的链接http://yourhost:5601,使用用户名/密码: elastic/elastic0登录。在”Configure an index pattern”页面点击Create按钮。点击菜单Monitor即可查看ELK节点的状态,默认密码已经修改成功。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。