200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 【ES】Mac部署ES本地开发环境-安装/docker集群

【ES】Mac部署ES本地开发环境-安装/docker集群

时间:2022-02-25 13:11:40

相关推荐

【ES】Mac部署ES本地开发环境-安装/docker集群

环境说明

mac

10.15.4

ES

7.7.0

安装

homebrew

elasticsearch

没有采用安装包安装的原因还是因为这个更方便~

lixiaoyu@localhost ~ % brew tap elastic/tapUpdating Homebrew...==> Tapping elastic/tapCloning into '/usr/local/Homebrew/Library/Taps/elastic/homebrew-tap'...remote: Enumerating objects: 156, done.remote: Counting objects: 100% (156/156), done.remote: Compressing objects: 100% (104/104), done.remote: Total 464 (delta 108), reused 84 (delta 52), pack-reused 308Receiving objects: 100% (464/464), 125.61 KiB | 400.00 KiB/s, done.Resolving deltas: 100% (340/340), done.Tapped 19 formulae (46 files, 228.2KB).lixiaoyu@localhost ~ % brew install elastic/tap/elasticsearch-full==> Installing elasticsearch-full from elastic/tap==> Downloading https://artifacts.elastic.co/downloads/elasticsearch/elasticsear######################################################################## 100.0%Warning: tried to install empty array to /usr/local/etc/elasticsearch/jvm.options.d==> codesign -f -s - /usr/local/Cellar/elasticsearch-full/7.7.0/libexec/modules/==> find /usr/local/Cellar/elasticsearch-full/7.7.0/libexec/jdk.app/Contents/Hom==> CaveatsData: /usr/local/var/lib/elasticsearch/elasticsearch_lixiaoyu/Logs: /usr/local/var/log/elasticsearch/elasticsearch_lixiaoyu.logPlugins: /usr/local/var/elasticsearch/plugins/Config: /usr/local/etc/elasticsearch/To have launchd start elastic/tap/elasticsearch-full now and restart at login:brew services start elastic/tap/elasticsearch-fullOr, if you don't want/need a background service you can just run:elasticsearch==> Summary🍺 /usr/local/Cellar/elasticsearch-full/7.7.0: 987 files, 472.4MB, built in 105 minutes 15 secondslixiaoyu@localhost ~ % brew services start elastic/tap/elasticsearch-full==> Tapping homebrew/servicesCloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...remote: Enumerating objects: 35, done.remote: Counting objects: 100% (35/35), done.remote: Compressing objects: 100% (26/26), done.remote: Total 726 (delta 8), reused 23 (delta 4), pack-reused 691Receiving objects: 100% (726/726), 200.78 KiB | 187.00 KiB/s, done.Resolving deltas: 100% (280/280), done.Tapped 1 command (40 files, 276.2KB).==> Successfully started `elasticsearch-full` (label: homebrew.mxcl.elasticsearc

打开浏览器,打开地址http://localhost:9200/,就表示安装成功,服务成功运行。

停止服务

lixiaoyu@localhost ~ % brew services stop elastic/tap/elasticsearch-fullStopping `elasticsearch-full`... (might take a while)==> Successfully stopped `elasticsearch-full` (label: homebrew.mxcl.elasticsearch-full)

Kibana

Kibana 是为 Elasticsearch设计的开源分析和可视化平台。

lixiaoyu@localhost ~ % brew install elastic/tap/kibana-fullUpdating Homebrew...==> Installing kibana-full from elastic/tap==> Downloading https://artifacts.elastic.co/downloads/kibana/kibana-7.7.0-darwin-x86_64.tar.gz?tap=elastic/homebrew######################################################################## 100.0%==> CaveatsConfig: /usr/local/etc/kibana/If you wish to preserve your plugins upon upgrade, make a copy of/usr/local/opt/kibana-full/plugins before upgrading, and copy it into thenew keg location after upgrading.To have launchd start elastic/tap/kibana-full now and restart at login:brew services start elastic/tap/kibana-fullOr, if you don't want/need a background service you can just run:kibana==> Summary🍺 /usr/local/Cellar/kibana-full/7.7.0: 149,308 files, 890.1MB, built in 69 minutes 38 secondslixiaoyu@localhost ~ % brew services start elastic/tap/kibana-full==> Successfully started `kibana-full` (label: homebrew.mxcl.kibana-full)

Kibana安装完成,打开网址localhost:5601即可进行下一步操作。

Docker

在一个文件夹内新建文件docker-compose.yml,内容如下

version: '2.2'services:cerebro:image: lmenezes/cerebro:0.8.3 # cerebro镜像container_name: cerebroports:- "36006:9000" # 容器端口映射到本地36006端口command:- -Dhosts.0.host=http://elasticsearch:5001 # 容器内部的ES地址networks:- es72netkibana:image: docker.elastic.co/kibana/kibana:7.2.0 # kibana7.2镜像container_name: kibana72 # 容器的名称environment: # 容器内部环境变量#- I18N_LOCALE=zh-CN- XPACK_GRAPH_ENABLED=true- TIMELION_ENABLED=true- XPACK_MONITORING_COLLECTION_ENABLED=true - SERVER_PORT=5005# Kibana端口- ELASTICSEARCH_HOSTS=http://elasticsearch:5001 # ES地址ports:- "36005:5005" # 容器端口5005映射到本地36005端口networks:- es72netelasticsearch:image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0 # ES 7.2镜像container_name: es72_01 # 容器名称environment:- cluster.name=web_news_query # 集群名称- node.name=news_5001_data # 节点名称- http.port=5001 # 节点端口- bootstrap.memory_lock=true- ES_JAVA_OPTS=-Xms512m -Xmx512m # 内存分配- discovery.seed_hosts=es72_01,es72_02 - network.publish_host=elasticsearch - cluster.initial_master_nodes=news_5001_data,news_5002_dataulimits:memlock:soft: -1hard: -1volumes:- es72data1:/es_dataports:- 36001:5001networks:- es72netelasticsearch2:image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0container_name: es72_02environment:- cluster.name=web_news_query- node.name=news_5002_data - http.port=5002- bootstrap.memory_lock=true- ES_JAVA_OPTS=-Xms512m -Xmx512m- discovery.seed_hosts=es72_01,es72_02 - cluster.initial_master_nodes=news_5001_data,news_5002_data ulimits:memlock:soft: -1hard: -1volumes:- es72data2:/es_dataports:- 36002:5002networks:- es72netvolumes:es72data1:driver: locales72data2:driver: localnetworks:es72net:driver: bridge

在目录下执行

docker-compose up

稍等片刻,服务就运行起来了。

总结

如果你的开发机内存比较大,比如16G,推荐安装docker环境,更加轻便。

如果你的开发机内存不大,比如8G或者更少,推荐本地安装。

参考资料

https://www.elastic.co/guide/en/kibana/7.7/brew.htmlhttps://www.elastic.co/cn/elasticsearch

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。