ELK-6.5.3學習筆記–elk基礎環境安裝

<article class="article-content"> <div class="read-time" style="color:#F86B06"><center>本文預計閱讀時間 <span>13</span> 分鐘</center></div><div id="toc-container"> <div id="toc">javascript

<strong>文章目錄</strong><span>[隱藏]</span>html

<ul> <li><a href="#toc-1" rel="nofollow" data-original-title="" title="">1,準備工做。</a></li> <li><a href="#toc-2" rel="nofollow" data-original-title="" title="">2,安裝elasticsearch。</a></li> <li><a href="#toc-3" rel="nofollow" data-original-title="" title="">3,安裝logstash。</a></li> <li><a href="#toc-4" rel="nofollow" data-original-title="" title="">4,安裝kibana</a></li> </ul> </div> </div> <p>以往都是紙上談兵,畢竟事情也都由部門其餘小夥伴承擔了,所以本身雖然也整理了筆記,當真的須要部署起來的時候,卻發現並無這個能力,此次也幾經磨難,總算修成正果,特此記錄一下。</p> <p>首先來快速將一個簡易的環境部署起來。<br> 其中防火牆關閉,selinux關閉等的就很少說了,系統是CentOS-7.3,乾淨並且初始化過了的環境。</p> <h3><a name="toc-1" data-original-title="" title=""></a>1,準備工做。</h3> <ul> <li>安裝一些依賴包。</li> </ul> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">yum </span><span class="pun">-</span><span class="pln">y install lrzsz vim curl wget java ntpdate </span><span class="pun">&amp;&amp;</span><span class="pln"> ntpdate </span><span class="pun">-</span><span class="pln">u cn</span><span class="pun">.</span><span class="pln">pool</span><span class="pun">.</span><span class="pln">ntp</span><span class="pun">.</span><span class="pln">org</span></code></li></ol></pre> <p>這裏java環境是很是重要的,若是不經過yum安裝,源碼方式也是能夠的。但要注意配置好環境變量。</p> <ul> <li>配置yum源。</li> </ul> <p>添加源:</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">cat </span><span class="pun">&gt;</span><span class="pln"> </span><span class="str">/etc/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">elk</span><span class="pun">.</span><span class="pln">repo </span><span class="pun">&lt;&lt;</span><span class="pln"> EOF</span></code></li><li class="L1"><code class="line-numbers"><span class="pun">[</span><span class="pln">elasticsearch</span><span class="pun">-</span><span class="lit">6.x</span><span class="pun">]</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">name</span><span class="pun">=</span><span class="typ">Elasticsearch</span><span class="pln"> repository </span><span class="kwd">for</span><span class="pln"> </span><span class="lit">6.x</span><span class="pln"> packages</span></code></li><li class="L3"><code class="line-numbers"><span class="pln">baseurl</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//artifacts.elastic.co/packages/6.x/yum</span></code></li><li class="L4"><code class="line-numbers"><span class="pln">gpgcheck</span><span class="pun">=</span><span class="lit">1</span></code></li><li class="L5"><code class="line-numbers"><span class="pln">gpgkey</span><span class="pun">=</span><span class="pln">https</span><span class="pun">:</span><span class="com">//artifacts.elastic.co/GPG-KEY-elasticsearch</span></code></li><li class="L6"><code class="line-numbers"><span class="pln">enabled</span><span class="pun">=</span><span class="lit">1</span></code></li><li class="L7"><code class="line-numbers"><span class="pln">autorefresh</span><span class="pun">=</span><span class="lit">1</span></code></li><li class="L8"><code class="line-numbers"><span class="pln">type</span><span class="pun">=</span><span class="pln">rpm</span><span class="pun">-</span><span class="pln">md</span></code></li><li class="L9"><code class="line-numbers"><span class="pln">EOF</span></code></li></ol></pre> <p>導入key:</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">rpm </span><span class="pun">--</span><span class="kwd">import</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//artifacts.elastic.co/GPG-KEY-elasticsearch</span></code></li></ol></pre> <p><code>若是執行這一步報錯,則有多是主機時間問題,能夠同步一下主機時間,再執行!</code></p> <blockquote><p> 注:一開始我想着把elk三個安裝包都緩存下來,這樣之後安裝起來就會方便的多了,因而我這麼作了,可是後來發現,通過緩存的包安裝的elk集羣,使用的時候是一種沒有受權的狀態,後來想起正常安裝時有這樣一個導入key的操做,思來想去,大概就是跟這一步有關係了。最後仍是老老實實的經過這樣一個流程方式進行安裝了。 </p></blockquote> <h3><a name="toc-2" data-original-title="" title=""></a>2,安裝elasticsearch。</h3> <p>直接yum安裝。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">yum </span><span class="pun">-</span><span class="pln">y install elasticsearch</span></code></li></ol></pre> <p>啓動服務。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">systemctl daemon</span><span class="pun">-</span><span class="pln">reload</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">systemctl enable elasticsearch</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">systemctl start elasticsearch</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L3"><code class="line-numbers"><span class="pln">systemctl status elasticsearch</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L4"><code class="line-numbers"></code></li><li class="L5"><code class="line-numbers"><span class="pln">curl localhost</span><span class="pun">:</span><span class="lit">9200</span></code></li></ol></pre> <p>調整一下配置文件:</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pun">[</span><span class="pln">root@elk </span><span class="pun">~]</span><span class="pln">$egrep </span><span class="pun">-</span><span class="pln">v </span><span class="str">"^#|^$"</span><span class="pln"> </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">elasticsearch</span><span class="pun">/</span><span class="pln">elasticsearch</span><span class="pun">.</span><span class="pln">yml</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">cluster</span><span class="pun">.</span><span class="pln">name</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">my</span><span class="pun">-</span><span class="pln">application</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">node</span><span class="pun">.</span><span class="pln">name</span><span class="pun">:</span><span class="pln"> node</span><span class="pun">-</span><span class="lit">1</span></code></li><li class="L3"><code class="line-numbers"><span class="pln">path</span><span class="pun">.</span><span class="pln">data</span><span class="pun">:</span><span class="pln"> </span><span class="str">/logs/</span><span class="pln">elasticsearch6</span></code></li><li class="L4"><code class="line-numbers"><span class="pln">path</span><span class="pun">.</span><span class="pln">logs</span><span class="pun">:</span><span class="pln"> </span><span class="str">/logs/</span><span class="pln">elasticsearch6</span><span class="pun">/</span><span class="pln">log</span></code></li><li class="L5"><code class="line-numbers"><span class="pln">network</span><span class="pun">.</span><span class="pln">host</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0.0</span><span class="pun">.</span><span class="lit">0.0</span></code></li><li class="L6"><code class="line-numbers"><span class="pln">http</span><span class="pun">.</span><span class="pln">port</span><span class="pun">:</span><span class="pln"> </span><span class="lit">9200</span></code></li><li class="L7"><code class="line-numbers"><span class="pln">discovery</span><span class="pun">.</span><span class="pln">zen</span><span class="pun">.</span><span class="pln">ping</span><span class="pun">.</span><span class="pln">unicast</span><span class="pun">.</span><span class="pln">hosts</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="str">"elk-node1"</span><span class="pun">]</span></code></li><li class="L8"><code class="line-numbers"><span class="pln">discovery</span><span class="pun">.</span><span class="pln">zen</span><span class="pun">.</span><span class="pln">minimum_master_nodes</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1</span></code></li><li class="L9"><code class="line-numbers"><span class="pln">xpack</span><span class="pun">.</span><span class="pln">security</span><span class="pun">.</span><span class="pln">enabled</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span></code></li></ol></pre> <ul> <li><code>cluster.name</code>:自定義集羣名,相同集羣內的節點設置相同的集羣名</li> <li><code>node.name</code>:自定義節點名,建議統一採用節點hostname</li> <li><code>path.data</code>:data存儲路徑,這裏更改爲自定義以應對日誌的big。</li> <li><code>path.logs</code>:log存儲路徑,是爲es本身的日誌。</li> <li>注意建立上邊兩項定義的兩個文件目錄。不然會啓動失敗。</li> </ul> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="pln">logs</span><span class="pun">/</span><span class="pln">elasticsearch6</span><span class="pun">/</span><span class="pln">log</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">cd </span><span class="pun">/</span><span class="pln">logs</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">chown </span><span class="pun">-</span><span class="pln">R elasticsearch</span><span class="pun">.</span><span class="pln">elasticsearch elasticsearch6</span><span class="pun">/</span></code></li></ol></pre> <ul> <li>注意要更改對應目錄的權限,不然es啓動會報以下錯誤。</li> </ul> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pun">[</span><span class="pln">root@elk logs</span><span class="pun">]</span><span class="pln">$systemctl status elasticsearch</span></code></li><li class="L1"><code class="line-numbers"><span class="pun">●</span><span class="pln"> elasticsearch</span><span class="pun">.</span><span class="pln">service </span><span class="pun">-</span><span class="pln"> </span><span class="typ">Elasticsearch</span></code></li><li class="L2"><code class="line-numbers"><span class="pln"> </span><span class="typ">Loaded</span><span class="pun">:</span><span class="pln"> loaded </span><span class="pun">(</span><span class="str">/usr/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">systemd</span><span class="pun">/</span><span class="pln">system</span><span class="pun">/</span><span class="pln">elasticsearch</span><span class="pun">.</span><span class="pln">service</span><span class="pun">;</span><span class="pln"> enabled</span><span class="pun">;</span><span class="pln"> vendor preset</span><span class="pun">:</span><span class="pln"> disabled</span><span class="pun">)</span></code></li><li class="L3"><code class="line-numbers"><span class="pln"> </span><span class="typ">Active</span><span class="pun">:</span><span class="pln"> failed </span><span class="pun">(</span><span class="typ">Result</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">exit</span><span class="pun">-</span><span class="pln">code</span><span class="pun">)</span><span class="pln"> since </span><span class="typ">Fri</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> CST</span><span class="pun">;</span><span class="pln"> </span><span class="lit">5min</span><span class="pln"> ago</span></code></li><li class="L4"><code class="line-numbers"><span class="pln"> </span><span class="typ">Docs</span><span class="pun">:</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//www.elastic.co</span></code></li><li class="L5"><code class="line-numbers"><span class="pln"> </span><span class="typ">Process</span><span class="pun">:</span><span class="pln"> </span><span class="lit">79428</span><span class="pln"> </span><span class="typ">ExecStart</span><span class="pun">=</span><span class="str">/usr/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">elasticsearch</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">elasticsearch </span><span class="pun">-</span><span class="pln">p $</span><span class="pun">{</span><span class="pln">PID_DIR</span><span class="pun">}/</span><span class="pln">elasticsearch</span><span class="pun">.</span><span class="pln">pid </span><span class="pun">--</span><span class="pln">quiet </span><span class="pun">(</span><span class="pln">code</span><span class="pun">=</span><span class="pln">exited</span><span class="pun">,</span><span class="pln"> status</span><span class="pun">=</span><span class="lit">1</span><span class="pun">/</span><span class="pln">FAILURE</span><span class="pun">)</span></code></li><li class="L6"><code class="line-numbers"><span class="pln"> </span><span class="typ">Main</span><span class="pln"> PID</span><span class="pun">:</span><span class="pln"> </span><span class="lit">79428</span><span class="pln"> </span><span class="pun">(</span><span class="pln">code</span><span class="pun">=</span><span class="pln">exited</span><span class="pun">,</span><span class="pln"> status</span><span class="pun">=</span><span class="lit">1</span><span class="pun">/</span><span class="pln">FAILURE</span><span class="pun">)</span></code></li><li class="L7"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Null</span><span class="pln"> </span><span class="kwd">object</span><span class="pln"> returned </span><span class="kwd">for</span><span class="pln"> </span><span class="typ">RollingFile</span><span class="pln"> </span><span class="kwd">in</span><span class="pln"> </span><span class="typ">Appenders</span><span class="pun">.</span></code></li><li class="L8"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"root"</span></code></li><li class="L9"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"index_indexing_slowlog_rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"index.indexing.slowlog.index"</span></code></li><li class="L0"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"audit_rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"org.elasticsearch.xpack.security....gAuditTrail"</span></code></li><li class="L1"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"index_search_slowlog_rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"index.search.slowlog"</span></code></li><li class="L2"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">084</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"deprecated_audit_rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"org.elasticsearch.xpac...gAuditTrail"</span></code></li><li class="L3"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk elasticsearch</span><span class="pun">[</span><span class="lit">79428</span><span class="pun">]:</span><span class="pln"> </span><span class="lit">2018</span><span class="pun">-</span><span class="lit">12</span><span class="pun">-</span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pun">,</span><span class="lit">085</span><span class="pln"> main ERROR </span><span class="typ">Unable</span><span class="pln"> to locate appender </span><span class="str">"deprecation_rolling"</span><span class="pln"> </span><span class="kwd">for</span><span class="pln"> logger config </span><span class="str">"org.elasticsearch.deprecation"</span></code></li><li class="L4"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk systemd</span><span class="pun">[</span><span class="lit">1</span><span class="pun">]:</span><span class="pln"> elasticsearch</span><span class="pun">.</span><span class="pln">service</span><span class="pun">:</span><span class="pln"> main process exited</span><span class="pun">,</span><span class="pln"> code</span><span class="pun">=</span><span class="pln">exited</span><span class="pun">,</span><span class="pln"> status</span><span class="pun">=</span><span class="lit">1</span><span class="pun">/</span><span class="pln">FAILURE</span></code></li><li class="L5"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk systemd</span><span class="pun">[</span><span class="lit">1</span><span class="pun">]:</span><span class="pln"> </span><span class="typ">Unit</span><span class="pln"> elasticsearch</span><span class="pun">.</span><span class="pln">service entered failed state</span><span class="pun">.</span></code></li><li class="L6"><code class="line-numbers"><span class="typ">Dec</span><span class="pln"> </span><span class="lit">14</span><span class="pln"> </span><span class="lit">15</span><span class="pun">:</span><span class="lit">12</span><span class="pun">:</span><span class="lit">48</span><span class="pln"> elk systemd</span><span class="pun">[</span><span class="lit">1</span><span class="pun">]:</span><span class="pln"> elasticsearch</span><span class="pun">.</span><span class="pln">service failed</span><span class="pun">.</span></code></li><li class="L7"><code class="line-numbers"><span class="typ">Hint</span><span class="pun">:</span><span class="pln"> </span><span class="typ">Some</span><span class="pln"> lines were ellipsized</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">use</span><span class="pln"> </span><span class="pun">-</span><span class="pln">l to show </span><span class="kwd">in</span><span class="pln"> full</span><span class="pun">.</span></code></li></ol></pre> <ul> <li><code>network.host</code>:es監聽地址,採用<code>"0.0.0.0"</code>,表示容許全部設備訪問。</li> <li><code>http.port</code>:es監聽端口,可不取消註釋,默認即此端口。</li> <li><code>discovery.zen.ping.unicast.hosts</code>:集羣節點發現列表,也可採用ip的形式</li> <li><code>discovery.zen.minimum_master_nodes</code>:若是暫時是單節點部署,能夠設置成1</li> <li><code>xpack.security.enabled</code>:添加這條,這條是配置kibana的安全機制,暫時關閉。</li> </ul> <p>重啓es。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">systemctl restart elasticsearch</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">systemctl status elasticsearch</span><span class="pun">.</span><span class="pln">service</span></code></li></ol></pre> <h3><a name="toc-3" data-original-title="" title=""></a>3,安裝logstash。</h3> <p>直接yum安裝。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">yum </span><span class="pun">-</span><span class="pln">y install logstash</span></code></li></ol></pre> <p>配置logstash。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pun">[</span><span class="pln">root@elk </span><span class="pun">~]</span><span class="pln">$egrep </span><span class="pun">-</span><span class="pln">v </span><span class="str">"^#|^$"</span><span class="pln"> </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">logstash</span><span class="pun">/</span><span class="pln">logstash</span><span class="pun">.</span><span class="pln">yml</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">path</span><span class="pun">.</span><span class="pln">data</span><span class="pun">:</span><span class="pln"> </span><span class="str">/var/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">logstash</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">path</span><span class="pun">.</span><span class="pln">config</span><span class="pun">:</span><span class="pln"> </span><span class="str">/etc/</span><span class="pln">logstash</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span></code></li><li class="L3"><code class="line-numbers"><span class="pln">path</span><span class="pun">.</span><span class="pln">logs</span><span class="pun">:</span><span class="pln"> </span><span class="str">/var/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">logstash</span></code></li></ol></pre> <p>這個地方重要的是第二條配置,同許多應用相似的,這裏定義了一個include的目錄,之後咱們的多個應用實例就能夠直接放置在這個目錄下了,這裏做爲了解,後邊並不會應用配置好的logstash,緣由在後邊會說。</p> <p>而後定義此logstash再也不使用系統管理啓動,而是之後經過命令行來起對應的logstash實例。<br> 同時建立軟連接,從而讓系統可以在<code>/usr/share/logstash</code>下讀取到相對應的logstash配置信息。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">systemctl disable logstash</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">ln </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">logstash </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">share</span><span class="pun">/</span><span class="pln">logstash</span><span class="pun">/</span><span class="pln">config</span></code></li></ol></pre> <p>而後logstash先放在這裏,不用啓動,對應的日誌等操做,後邊就會介紹了。</p> <h3><a name="toc-4" data-original-title="" title=""></a>4,安裝kibana</h3> <p>直接yum安裝。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">yum </span><span class="pun">-</span><span class="pln">y install kibana</span></code></li></ol></pre> <p>配置kibana。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pun">[</span><span class="pln">root@elk </span><span class="pun">~]</span><span class="pln">$egrep </span><span class="pun">-</span><span class="pln">v </span><span class="str">"^#|^$"</span><span class="pln"> </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">kibana</span><span class="pun">/</span><span class="pln">kibana</span><span class="pun">.</span><span class="pln">yml</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">server</span><span class="pun">.</span><span class="pln">port</span><span class="pun">:</span><span class="pln"> </span><span class="lit">5601</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">server</span><span class="pun">.</span><span class="pln">host</span><span class="pun">:</span><span class="pln"> </span><span class="str">"0.0.0.0"</span></code></li><li class="L3"><code class="line-numbers"><span class="pln">elasticsearch</span><span class="pun">.</span><span class="pln">url</span><span class="pun">:</span><span class="pln"> </span><span class="str">"http://10.100.120.82:9200"</span></code></li><li class="L4"><code class="line-numbers"><span class="pln">kibana</span><span class="pun">.</span><span class="pln">index</span><span class="pun">:</span><span class="pln"> </span><span class="str">".newkibana"</span></code></li><li class="L5"><code class="line-numbers"><span class="pln">xpack</span><span class="pun">.</span><span class="pln">security</span><span class="pun">.</span><span class="pln">enabled</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">false</span><span class="pln"> </span><span class="com">#添加這條,這條是配置kibana的安全機制,暫時關閉。</span></code></li></ol></pre> <ul> <li><code>kibana.index</code>:原來默認是<code>".kibana"</code>,可是新版本的kibana啓動以後發現沒法訪問,訪問以後拋出一個異常:<code>kibana server is not ready yet</code>,那麼回來把配置更改爲<code>".newkibana"</code>,而後重啓kibana,再次訪問,便可成功。</li> </ul> <p>啓動kibana。</p> <pre class="prettyprint linenums"><ol class="linenums"><li class="L0"><code class="line-numbers"><span class="pln">systemctl enable kibana</span><span class="pun">.</span><span class="pln">service</span></code></li><li class="L1"><code class="line-numbers"><span class="pln">systemctl restart kibana</span></code></li><li class="L2"><code class="line-numbers"><span class="pln">systemctl status kibana</span></code></li></ol></pre> <p>到這兒,基本上,做爲單臺的elk主機上的工做基本上已經完成,能夠說很是簡單,而,戲,也今後剛剛開始而已。</p> <hr><div class="s-weixin-one" style="margin:10px auto 20px;width:25pc"><div class="weimg-one" style="padding:5px;border:1px dashed #ccc"> <img src="http://www.eryajf.net/wp-content/uploads/2018/12/2018120715213483.png" alt="weinxin" style="float:left;margin:0 10px 0 0;width:30%;height:auto"><div class="weixin-h" style="float:left;width:65%"><strong>掃碼訂閱本站,第一時間得到更新</strong></div><div style="float:left;width:65%;color:#999" class="weixin-h-w">微信掃描二維碼,訂閱咱們網站的動態,另外不定時發送WordPress小技巧,你能夠隨時退訂,歡迎訂閱哦~</div><div class="clear"></div></div></div><hr><div class="open-message">二丫講梵 , 版權全部丨如未註明 , 均爲原創丨本網站採用<a href="http://www.eryajf.net/go?url=http://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow" target="_blank" title="" data-original-title="BY-NC-SA受權協議">BY-NC-SA</a>協議進行受權 , 轉載請註明<a href="http://www.eryajf.net/2351.html" target="_blank" title="" data-original-title="<一>ELK-6.5.3學習筆記–elk基礎環境安裝">&lt;一&gt;ELK-6.5.3學習筆記–elk基礎環境安裝</a>!</div> <div class="article-social"> <a href="javascript:;" data-action="ding" data-id="2351" id="Addlike" class="action" data-original-title="" title=""><i class="fa fa-heart-o"></i>喜歡 (<span class="count">6</span>)</a><span class="or"><style>.article-social .weixin:hover{background:#fff;}</style><a class="weixin" style="border-bottom:0px;font-size:15pt;cursor:pointer;" data-original-title="" title="">賞<div class="weixin-popover"><div class="popover bottom in"><div class="arrow"></div><div class="popover-title"><center>[若是想支持本站,可支付寶贊助]</center></div><div class="popover-content"><img width="200px" height="200px" src="https://ae01.alicdn.com/kf/HTB17dqke21G3KVjSZFk761K4XXav.png"></div></div></div></a></span><span class="action action-share bdsharebuttonbox"><i class="fa fa-share-alt"></i>分享 (<span class="bds_count" data-cmd="count" title="累計分享0次">0</span>)<div class="action-popover"><div class="popover top in"><div class="arrow"></div><div class="popover-content"><a href="#" class="sinaweibo fa fa-weibo" data-cmd="tsina" title="" data-original-title="分享到新浪微博"></a><a href="#" class="bds_qzone fa fa-star" data-cmd="qzone" title="" data-original-title="分享到QQ空間"></a><a href="#" class="qq fa fa-qq" data-cmd="sqq" title="" data-original-title="分享到QQ好友"></a><a href="#" class="bds_renren fa fa-renren" data-cmd="renren" title="" data-original-title="分享到人人網"></a><a href="#" class="bds_weixin fa fa-weixin" data-cmd="weixin" title="" data-original-title="分享到微信"></a><a href="#" class="bds_more fa fa-ellipsis-h" data-cmd="more" data-original-title="" title=""></a></div></div></div></span></div> 原文地址:http://www.eryajf.net/2351.html</article>java

相關文章
相關標籤/搜索