<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Docker 方式安裝 原文鏈接 : [https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html) 譯文鏈接 : [http://apache.wiki/pages/editpage.action?pageId=4882734](http://apache.wiki/pages/editpage.action?pageId=4882734) 貢獻者 : @漫步 ## Docker 方式安裝 Elasticsearch也可作為一個docker鏡像來安裝。該鏡像是需要?[X-Pack](https://www.elastic.co/guide/en/x-pack/5.0/index.html) 來built ## 安全注意事項[](https://github.com/elastic/elasticsearch/edit/5.0/docs/reference/setup/install/docker.asciidoc "編輯GitHub上此頁") ![注意](https://img.kancloud.cn/50/1f/501f430e0c03baa87f0bbf9c0e08af0d_66x58.jpg) [X-Pack](https://www.elastic.co/guide/en/x-pack/5.0/index.html) 被在此圖像中預裝。請花幾分鐘時間來熟悉[的](https://www.elastic.co/guide/en/x-pack/5.0/security-getting-started.html)[X-Pack](https://www.elastic.co/guide/en/x-pack/5.0/index.html)[安全](https://www.elastic.co/guide/en/x-pack/5.0/security-getting-started.html)和如何更改默認密碼。為默認密碼`elastic`用戶`changeme`。 ![注意](https://img.kancloud.cn/50/1f/501f430e0c03baa87f0bbf9c0e08af0d_66x58.jpg) [X-Pack](https://www.elastic.co/guide/en/x-pack/5.0/index.html) 包括30天的試用許可證。在這之后,你可以得到一個[可用的預訂](https://www.elastic.co/subscriptions)或[停用安全](https://www.elastic.co/guide/en/x-pack/5.0/security-settings.html)。基本許可證是免費的,包括[監控](https://www.elastic.co/products/x-pack/monitoring)擴展。 獲取Elasticsearch的碼頭工人是發出一個簡單`docker pull`靠彈性泊塢窗注冊表命令。 泊塢窗圖像可以用下面的命令得到: ``` docker pull docker.elastic.co/elasticsearch/elasticsearch:5.0.1 ``` ## 在命令行中運行Elasticsearch ### 開發模式 Elasticsearch可以很快開始為開發或測試使用用下面的命令: ``` docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" docker.elastic.co/elasticsearch/elasticsearch:5.0.1 ``` ### 生產方式 ![重要](https://img.kancloud.cn/15/d7/15d74881ee7292bc56d26f6af9b642a8_66x58.jpg) `vm_max_map_count`內核設置需要被設置到至少`262144`用于生產。根據您的平臺: * Linux 該`vm_map_max_count`設置應永久在/etc/sysctl.conf中進行設置: ``` $ grep的vm.max_map_count的/etc/sysctl.conf vm.max_map_count = 262144 ``` 應用設置在實時系統類型:?`sysctl -w vm.max_map_count=262144` * OSX with?[Docker for Mac](https://docs.docker.com/engine/installation/mac/#/docker-for-mac)`vm_max_map_count`設置必須與xhyve虛擬機中進行設置: ``` $ screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty ``` 登錄,沒有密碼。然后配置`sysctl`設置: ``` sysctl的-w vm.max_map_count = 262144 ``` OSX with?[Docker Toolbox](https://docs.docker.com/engine/installation/mac/#docker-toolbox) `vm_max_map_count`設置必須通過泊塢窗機進行設置: ``` docker-machine ssh sudo sysctl -w vm.max_map_count=262144 ``` 下面的例子帶來了包括兩個Elasticsearch節點的群集。要打開集群,使用[`docker-compose.yml`](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-cluster-composefile)和公正的類型: ``` docker-compose up ``` ![注意](https://img.kancloud.cn/50/1f/501f430e0c03baa87f0bbf9c0e08af0d_66x58.jpg) `docker-compose`沒有預裝泊塢窗上的Linux。說明安裝它可以在找到[泊塢窗,撰寫網頁](https://docs.docker.com/compose/install/#install-using-pip)。 節點`elasticsearch1`監聽`localhost:9200`,而`elasticsearch2`談判`elasticsearch1`在碼頭工人的網絡。 這個例子還使用[泊塢命名卷](https://docs.docker.com/engine/tutorials/dockervolumes),被稱為`esdata1`和`esdata2`將,如果不存在創建。 `docker-compose.yml`: ``` version: '2' services: elasticsearch1: image: docker.elastic.co/elasticsearch/elasticsearch:5.0.1 container_name: elasticsearch1 environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 mem_limit: 1g cap_add: - IPC_LOCK volumes: - esdata1:/usr/share/elasticsearch/data ports: - 9200:9200 networks: - esnet elasticsearch2: image: docker.elastic.co/elasticsearch/elasticsearch:5.0.1 environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - "discovery.zen.ping.unicast.hosts=elasticsearch1" ulimits: memlock: soft: -1 hard: -1 nofile: soft: 65536 hard: 65536 mem_limit: 1g cap_add: - IPC_LOCK volumes: - esdata2:/usr/share/elasticsearch/data networks: - esnet volumes: esdata1: driver: local esdata2: driver: local networks: esnet: driver: bridge ``` 要停止集群類型`docker-compose down`。數據量將繼續存在,因此有可能使用相同的數據與重新開始集群`docker-compose up`。要銷毀集群**和數據量**只需鍵入`docker-compose down -v`。 ### 檢查集群的現狀 ``` curl -u elastic http://127.0.0.1:9200/_cat/health Enter host password for user 'elastic': 1472225929 15:38:49 docker-cluster green 2 2 4 2 0 0 0 0 - 100.0% ``` 將消息記錄到控制臺和配置多克爾記錄駕駛員進行處理。默認情況下,你可以訪問日志`docker logs`。 ## ?docker配置Elasticsearch Elasticsearch從加載文件下它的配置`/usr/share/elasticsearch/config/`。這些配置文件都記錄在[_配置Elasticsearch_](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html "配置Elasticsearch")和[設置JVM系統屬性](https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-system-settings.html#es-java-opts "設置JVM系統屬性")。 圖像提供了多種方式與傳統的方法是提供自定義的文件,即配置Elasticsearch設置`elasticsearch.yml`,但它也可以使用環境變量設置選項: #### A.通過docker環境變量傳遞參數 例如,要定義與群集名稱`docker run`可以傳遞`-e "[cluster.name](http://cluster.name)=mynewclustername"`。雙引號是必需的。 ![注意](https://img.kancloud.cn/50/1f/501f430e0c03baa87f0bbf9c0e08af0d_66x58.jpg) 有限定之間的差[的默認設置](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html#_setting_default_settings "設置默認settingsedit")和正常設置。前者的前綴`default.`并不能覆蓋正常的設置,如果定義。 #### B.綁定安裝配置 創建自定義配置文件并安裝這個在圖像上的相應文件。例如,綁定安裝一個`custom_elasticsearch.yml`帶有`docker run`可以通過參數來實現: ``` -v full_path_to / custom_elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml ``` ![重要](https://img.kancloud.cn/15/d7/15d74881ee7292bc56d26f6af9b642a8_66x58.jpg) `custom_elasticsearch.yml`?應該是可讀的UID:GID?`1000:1000` #### C.自定義圖像 在某些環境中,它可能會更有意義,以制備含有配置的自定義圖像。一個`Dockerfile`實現,這可能是簡單的: ``` FROM docker.elastic.co/elasticsearch/elasticsearch:5.0.1 ADD elasticsearch.yml /usr/share/elasticsearch/config/ USER root chown elasticsearch:elasticsearch config/elasticsearch.yml USER elasticsearch ``` 然后,您可以建立并嘗試與類似的圖像: ``` docker build --tag=elasticsearch-custom . docker run -ti -v /usr/share/elasticsearch/data elasticsearch-custom ``` #### D.覆蓋圖像的默認[CMD](https://docs.docker.com/engine/reference/run/#cmd-default-command-or-options) 選項可以作為命令行選項來Elasticsearch過程覆蓋默認命令為圖像傳遞。例如: ``` docker run <various parameters> bin/elasticsearch -Ecluster.name=mynewclustername ``` ## 默認生產和使用的注意事項 我們收集了一些供生產使用的最佳實踐。 ![注意](https://img.kancloud.cn/50/1f/501f430e0c03baa87f0bbf9c0e08af0d_66x58.jpg) 以下提到的任何參數碼頭工人承擔使用`docker run`。 1. 經由多克爾CLI正確設置的功能和ulimits是重要的。正如前面的例子中看出[docker-compose.yml](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-prod-cluster-composefile),需要下列選項: ``` --cap-add=IPC_LOCK --ulimit memlock=-1:-1 --ulimit nofile=65536:65536 ``` 2. 確保`bootstrap.memory_lock`被設置為`true`如在“解釋[禁用交換](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration-memory.html "禁用交換")?”。 這可以通過任何的實現[的配置方法](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-configuration-methods "與泊塢窗配置Elasticsearch"),例如,通過設置與適當的環境變量`-e "bootstrap.memory_lock=true"`。 3. 形象[暴露](https://docs.docker.com/engine/reference/builder/#/expose)?TCP端口9200和9300。對于建議隨機與發布的港口集群`--publish-all`,除非你是釘住每個主機一個容器。 4. 使用`ES_JAVA_OPTS`環境變量設置堆大小,如使用16GB的使用`-e ES_JAVA_OPTS="-Xms16g -Xmx16g"`與`docker run`。此外,還建議設置[內存限制](https://docs.docker.com/engine/reference/run/#user-memory-constraints)的容器。 5. 固定您的部署到Elasticsearch多克爾圖像的特定版本,例如`[docker.elastic.co/elasticsearch/elasticsearch:5.0.1](http://docker.elastic.co/elasticsearch/elasticsearch:5.0.1)`。 6. 總是使用上結合的體積`/usr/share/elasticsearch/data`,如圖中[生產例子](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode "生產模式"),原因如下: 1. 如果容器殺了你elasticsearch節點的數據也不會丟失 2. Elasticsearch是I / O敏感和泊塢窗存儲驅動程序是不理想的高速I / O 3. 它可以利用先進的[docker 容器插件](https://docs.docker.com/engine/extend/plugins/#volume-plugins) 7. 如果您使用的是devicemapper存儲驅動程序(默認情況下至少紅帽(RPM)的分布)確保你不使用默認`loop-lvm`模式。配置泊塢窗引擎使用[直接LVM](https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/#configure-docker-with-devicemapper)來代替。 8. 請考慮使用不同的集中你的日志[記錄的驅動程序](https://docs.docker.com/engine/admin/logging/overview/)。還要注意的是默認的JSON文件記錄的驅動程序并不適合用于生產。 ## 下一步 現在,您有一個測試環境Elasticsearch成立。開始之前嚴重的發展或進入生產與Elasticsearch,你需要做一些額外的設置: * 了解如何[配置Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html "配置Elasticsearch")。 * 配置[重要Elasticsearch設置](https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html "重要Elasticsearch配置")。 * 配置[重要的系統設置](https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html "重要的系統配置")。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看