<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>运维之道</title><link>http://pyops.net/</link><description>潜龙勿用,见龙在田</description><item><title>人体碘元素知识</title><link>http://pyops.net/?id=67</link><description>&lt;p style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;text_ki2nn&quot; data-text=&quot;true&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;text_ki2nn&quot; data-text=&quot;true&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;碘（化学符号：I，原子序数：53）,&lt;span class=&quot;text_ki2nn&quot; data-text=&quot;true&quot;&gt;碘是一种深紫色的固体，在常温常压下呈片状晶体。它具有较强的挥发性，当受热时，固体碘会直接转变为紫色的气体.&lt;span class=&quot;text_ki2nn&quot; data-text=&quot;true&quot;&gt;在水中，碘不溶解，但可以溶解于一些有机溶剂中，例如乙醇和二甲苯。碘具有氧化性，在一些反应中可以作为氧化剂，例如氧化亚硫酸根离子为硫酸根离子。碘及其化合物在医药、生物化学和化学分析等领域具有重要应用。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;text_ki2nn&quot; data-text=&quot;true&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;碘是人体必需的微量元素之一，体内不能生成，需从外环境获取，对于儿童和孕妇的健康发育尤为重要。碘缺乏会影响大脑发育和认知功能，因此在一些地区，政府和卫生组织会通过盐碘化等方式进行碘的补充。&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;缺碘可能导致的问题&lt;/h4&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-size: 14px;&quot;&gt;新生儿期可致新生儿甲减、甲状腺肿；&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;儿童及青春期可致甲状腺肿、亚临床克汀病、智力和体格发育障碍、单纯性耳聋等；&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;成人则可引起甲状腺肿及其并发症、甲减、智力障碍、碘性甲亢&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;碘缺乏病的临床表现极为复杂，往往取决于缺碘的严重程度，以及缺碘时机体所处的发育阶段。胎儿期可发生消瘦、心跳加快、脾气变怪、急躁易怒、眼球突出、甲状腺肿大等，此病也称“甲状腺机能亢进症”&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei; font-size: 14px;&quot;&gt;&lt;em&gt;碘缺乏对于现在的人来说，是一种不太可能出现的疾病，因为现在的食用盐还有我们平时的饮食上碘元素含量还是非常高的，比如很多的家庭现在每一餐都含有海鱼或者是海产品。无碘盐孩子是可以吃的，随着经济和社会的发展，儿童的营养价值相对均衡，目前因缺碘引起的甲状腺肿比较少见，因此吃非碘盐是可以。这样既能补充丰富的钠离子，平衡体内离子水平，促进儿童身体发育，又能避免碘离子摄入过多造成的身体不适&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;碘的用量&lt;/h4&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;&lt;span style=&quot;color: #000000; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;人体不能够储存大量碘，因此我们需要经常摄取少量碘。如大量摄入，碘很快会经由尿液排出。长时间摄入过量碘可能影响甲状腺功能。一般健康的&lt;/span&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;span style=&quot;font-size: 16px; color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none; text-decoration: underline;&quot;&gt;成年人每天&lt;/span&gt;&lt;span style=&quot;font-size: 16px; text-decoration: underline; color: #FF0000;&quot;&gt;不宜摄入&lt;/span&gt;&lt;span style=&quot;font-size: 16px; text-decoration: underline;&quot;&gt;多于600微克碘&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: 16px; text-decoration: none;&quot;&gt;。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none; font-size: 16px; text-decoration: none; font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;若保持穩定每日補充，人體只需小量的碘便已足夠。如大量攝入，碘很快會經腎臟排到尿液中。長時間攝入過量碘可能影響正常的甲狀腺功能，一般健康的&lt;em style=&quot;color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;成年人可安全承受每日達1000微克碘&lt;/em&gt;&lt;span style=&quot;text-decoration-line: none; text-decoration-thickness: auto; color: #000000; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none; font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;攝入量。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;世卫组织推荐每天的碘摄入量不要低于44微克/天，碘的安全数量范围在50微克～1000微克每天，成年人理想的碘摄入量为&lt;/span&gt;&lt;span style=&quot;color: #000000; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; display: inline !important; float: none; font-family: 微软雅黑, Microsoft YaHei; font-size: 16px; text-decoration: underline;&quot;&gt;150微克/天&lt;/span&gt;。&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;世界卫生组织《成人和儿童钠摄入量指南（2012）》和我国《中国居民膳食指南（2022版）》均建议&lt;/span&gt;&lt;strong style=&quot;color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;成人每天盐摄入量不超过6克&lt;/strong&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;。 按照我国《食用盐碘含量》（GB 26878-2011）标准，如果食盐强化碘量水平为25毫克/千克，烹调损失率按世卫组织推荐的20%计算，每天从加碘食盐中可摄入碘100微克&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span style=&quot;font-family: 微软雅黑, Microsoft YaHei; font-size: 14px;&quot;&gt;严重缺碘或者碘过量都会导致甲状腺肿大问题，甲亢患者每天碘的摄入量尽量控制在50微克以下&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;顺带提一下盐的摄入量&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;正常人一天不超过6~8克&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;含碘盐的&lt;span data-wiz-span=&quot;data-wiz-span&quot; style=&quot;font-family: 微软雅黑; font-size: 16px;&quot;&gt;碘含量标准一般是：20mg/kg至30mg/kg，一般看到的2500微克/100g 就是非常标准的含量，&lt;/span&gt;也就是每一克加碘盐里还有约25微克的碘&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;2段奶粉含碘量：105ug/100g 奶粉，一勺奶粉约7.5g，也就是相当于7.5微克的碘，以奶粉为主的宝宝一天的奶量为150~200毫升*4次，差不多 3.5勺*4*7.5ug = 105 ug 碘，已经超过需求量的一倍了，非常充足。 如果每天吃两次牛奶的儿童也有几十微克的碘补充，再加上其它食物中的碘的摄入，不用担心碘摄入量问题。&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;br style=&quot;color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;/&gt;&lt;br/&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1.25rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;BxUVEf ILfuVd&quot; style=&quot;&quot;&gt;&lt;strong&gt;&lt;span data-wiz-span=&quot;data-wiz-span&quot; style=&quot;font-family: 微软雅黑;&quot;&gt;碘的合理摄入&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;BxUVEf ILfuVd&quot;&gt;&lt;span class=&quot;hgKElc&quot;&gt;可以通过食用加碘盐，食用含碘量较高的食物或者服用补碘制剂来补充碘。其中，海带、紫菜含碘量最高，干海带碘含量能达到36240μg/100g；蛋类含碘量较高（如鹌鹑蛋233 μg /100g)；奶类、肉类和植物性食物含碘量很低。其他补碘制剂包括含碘营养素补充剂、碘油丸等。&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;BxUVEf ILfuVd&quot;&gt;&lt;span class=&quot;hgKElc&quot;&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;一般人群&lt;br/&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;1、建议一般人群每天摄入5g加碘食盐，可摄入碘100μg，加上饮水和食物中摄入的碘，则能达到一般人群碘推荐摄入量（120μg/d~ 150μg/d）。&lt;/p&gt;2、建议除了居住在高水碘地区的居民不食用加碘食盐外，其他居民都应食用加碘食盐。另外沿海地区经常使用海产品的居民基本不用在食用加碘盐了，反而要注意控制&lt;br/&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;BxUVEf ILfuVd&quot;&gt;&lt;span class=&quot;hgKElc&quot;&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;婴幼儿及青少年&lt;br/&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;1、我国食品标准规定婴幼儿乳制品加碘量为每100kJ（千焦）加碘2.5～14.0μg或每100kcal（千卡）加碘10.5～58.6μg；建议婴幼儿的辅食中应有含碘丰富的海产品。&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;2、儿童青少年各器官生长发育快，基础代谢增强，碘消耗较多，应食用加碘食盐。&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;妊娠期及哺乳期&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;1、每天摄入5g加碘食盐；&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;2、加上饮水和食物中摄入的碘，则能达到一般人群碘推荐摄入量（120μg/d）；&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;3、额外增加富含碘的海带/紫菜1-2次/周；&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;4、可服用含碘补充剂。&lt;/p&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span class=&quot;BxUVEf ILfuVd&quot;&gt;&lt;span class=&quot;hgKElc&quot;&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;高碘地区及沿海地区&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;1、我国高碘地区（徐州市丰县、沛县两县及泉山、铜山、睢宁、邳州的部分乡镇）无需再补碘；当地无加碘盐；&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px;&quot;&gt;2、沿海地区生产海带、紫菜等富碘食物，哪怕半月吃一次都能顶半月的碘量了。再加上平日吃些贝类、海鱼类，只有担心是否过量的问题。当然还是得看频率&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;甲状腺结节是否可以吃海鲜？&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;只要甲状腺功能正常，就依然可以吃海鲜，同时依然需要吃加碘的食盐；若甲状腺结节导致了甲亢，需要限碘。&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #000000; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #FFFFFF; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1.25rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span data-wiz-span=&quot;data-wiz-span&quot; style=&quot;font-family: 微软雅黑;&quot;&gt;各组织/机构推荐的每日碘的摄入量参考&lt;/span&gt;&lt;/h2&gt;&lt;ul style=&quot;list-style-type: disc;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p style=&quot;margin: 1.25rem 0px 0.625rem; padding: 0px; font-weight: bold; font-size: 1rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;span style=&quot;font-size: 14px; font-family: 微软雅黑, Microsoft YaHei;&quot;&gt;&lt;strong&gt;《中国居民膳食营养素参考摄入量》-2023版&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2025/02/202502161739635432513918.jpg&quot; title=&quot;1.jpg&quot; alt=&quot;1.jpg&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Sat, 15 Feb 2025 22:06:40 +0800</pubDate></item><item><title>java环境-JDK下载安装</title><link>http://pyops.net/?id=66</link><description>&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;先解释下JDK/JRE的区别：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;简单概述：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;JDK是Java的开发工具，它不仅提供了Java程序运行所需的JRE，还提供了一系列的编译，运行等工具，如javac，java，javaw等，还有运维经常用到的jstat/jstack/jmap等工具&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;JRE只是Java程序的运行环境，它最核心的内容就是JVM（Java虚拟机）及核心类库。没有jdk里用到的相关工具&lt;/div&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;引用一张网上的图直观了解下：&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/11/202011181605690765436165.jpg&quot; title=&quot;Java各种集成开发工具.jpg&quot; alt=&quot;Java各种集成开发工具.jpg&quot;/&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;好了，下面介绍下JDK的情况。目前主要用到的JDK发行版主要是Oracle JDK以及OpenJDK：&lt;/div&gt;&lt;h3 style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;strong&gt;Oracle JDK&lt;/strong&gt;：&lt;/h3&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;现在去官网下载很麻烦了，需要注册或者agree license等等，下载也慢。要么使用openjdk，或者使用国内华为镜像加速站：[也是刚建立没多久]&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;华为镜像站：https://mirrors.huaweicloud.com/java/jdk/
wget&amp;nbsp;https://mirrors.huaweicloud.com/java/jdk/11.0.2+9/jdk-11.0.2_linux-x64_bin.tar.gz&lt;/pre&gt;&lt;h3 style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;strong&gt;OpenJDK&lt;/strong&gt;：&lt;/h3&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;span style=&quot;background-color: #FFFFFF;&quot;&gt;OpenJDK是Oracle的分发版，由社区维护，&lt;/span&gt;yum可以直接安装，速度也快，在目前情势下可以推荐使用openjdk了&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;a href=&quot;https://jdk.java.net/&quot; style=&quot;overflow-wrap: break-word; background-color: rgb(255, 255, 255); font-size: 16px; text-decoration: underline;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;https://jdk.java.net/&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 16px;&quot;&gt;&amp;nbsp;有oracle 基于GPL的openjdk下载，不需要任何交互，但是家庭电信网络速度有点慢，我在家下载最高只有8Mbps，下了一部分最后只有几十KB每秒了。类似具有BGP网络的阿里云下载速度能够达到30Mbps以上。&lt;/span&gt;&lt;br/&gt;&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;wget&amp;nbsp;https://download.java.net/openjdk/jdk11/ri/openjdk-11+28_linux-x64_bin.tar.gz&amp;nbsp;&amp;nbsp;#&amp;nbsp;速度不咋地，不适合写到脚本里.&lt;/pre&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;color: #222831; background-color: #FFFFFF; font-size: 16px;&quot;&gt;貌似还有个AdoptOpenJDK，似乎也没有太去关注什么区别，只要运行没有问题就行。OpenJDK和AdoptOpenJDK有什么区别？请参考：&lt;a href=&quot;https://mlog.club/article/1891842&quot; style=&quot;word-wrap: break-word;&quot;&gt;https://mlog.club/article/1891842&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;AdoptOpenJDK清华镜像站：https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/
wget&amp;nbsp;https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/11/jdk/x64/linux/OpenJDK11U-jdk_x64_linux_openj9_11.0.6_10_openj9-0.18.1.tar.gz&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; widows: 1; font-size: 16px;&quot;&gt;# 速度还可以接受，放脚本里没问题，但是不建议。可以事先下载下来&lt;/span&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;个人觉得，如果没有特殊需求就用openjdk也可以，非得用Oracle JDK就去官方下载。&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;# yum安装方式：&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;yum&amp;nbsp;install&amp;nbsp;-y&amp;nbsp;java-11-openjdk-headless&amp;nbsp;java-11-openjdk.x86_64&amp;nbsp;java-11-openjdk-devel.x86_64&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;最终建议下载使用二进制包方式安装，事先下载后可进行脚本化：&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;wget&amp;nbsp;https://mirrors.huaweicloud.com/java/jdk/11.0.2+9/jdk-11.0.2_linux-x64_bin.tar.gz

tar&amp;nbsp;xf&amp;nbsp;jdk-11.0.2_linux-x64_bin.tar.gz&amp;nbsp;-C&amp;nbsp;/usr/local/src/
ln&amp;nbsp;-s&amp;nbsp;/usr/local/src/jdk-11.0.2&amp;nbsp;/usr/local/jdk
ln&amp;nbsp;-s&amp;nbsp;/usr/local/jdk/bin/java&amp;nbsp;&amp;nbsp;/usr/bin/
cat&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/profile&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;\EOF
export&amp;nbsp;JAVA_HOME=/usr/local/jdk
export&amp;nbsp;PATH=$JAVA_HOME/bin:$PATH
EOF&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 09 Apr 2020 00:54:02 +0800</pubDate></item><item><title>elasticsearch安装部署</title><link>http://pyops.net/?id=57</link><description>&lt;p&gt;一）下载:&lt;/p&gt;&lt;p&gt;elk系列下载地址: https://www.elastic.co/cn/downloads&lt;br/&gt;&lt;/p&gt;&lt;p&gt;国内下载镜像：https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/&lt;/p&gt;&lt;p&gt;二）安装&lt;/p&gt;&lt;p&gt;企业最佳安装实践为rpm包方式安装，通过脚本批量快速部署。&lt;/p&gt;&lt;p&gt;1）RPM包安装方式&lt;/p&gt;&lt;p&gt;rpm安装方式：&lt;/p&gt;&lt;p&gt;wget https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/7.4.2/elasticsearch-7.4.2-x86_64.rpm&lt;/p&gt;&lt;p&gt;rpm -ivh elasticsearch-7.4.2-x86_64.rpm&lt;br/&gt;&lt;/p&gt;&lt;p&gt;2）yum安装方式&lt;/p&gt;&lt;p&gt;有启动控制脚本比较方便。如果换成国内yum源仍旧慢，则还是使用rpm包安装方式吧&lt;/p&gt;&lt;p&gt;增加yum仓库：[很遗憾的是国内几乎没法下载,改成清华的源吧]&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;rpm&amp;nbsp;--import&amp;nbsp;https://packages.elastic.co/GPG-KEY-elasticsearch
cat&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/yum.repos.d/elk.repo&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;EOF
[elastic-7.x]
name=Elastic&amp;nbsp;repository&amp;nbsp;for&amp;nbsp;7.x&amp;nbsp;packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;# 清华yum源，速度也不咋地，还是下载rpm包安装吧&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cat&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/yum.repos.d/elk.repo&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;EOF
[elastic-7.x]
name=Elastic&amp;nbsp;repository&amp;nbsp;for&amp;nbsp;7.x&amp;nbsp;packages
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;yum install -y elasticsearch&lt;br/&gt;&lt;/p&gt;&lt;p&gt;三）配置&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;主配置文件：/etc/elasticsearch/elasticsearch.yml&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;jvm.options：主要是用于调整内存es内存大小使用，实际根据内存大小进行分配。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;1）单机模式&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;node.name:&amp;nbsp;node-01
path.data:&amp;nbsp;/data/elasticsearch/data
path.logs:&amp;nbsp;/data/elasticsearch/logs
network.host:&amp;nbsp;0.0.0.0
http.port:&amp;nbsp;9200
discovery.seed_hosts:&amp;nbsp;[&amp;quot;127.0.0.1&amp;quot;,&amp;nbsp;&amp;quot;[::1]&amp;quot;]
discovery.type:&amp;nbsp;single-node
http.cors.enabled:&amp;nbsp;true
http.cors.allow-origin:&amp;nbsp;&amp;quot;*&amp;quot;
#&amp;nbsp;单机模式开启安全认证添加下面两行
xpack.security.enabled:&amp;nbsp;true
xpack.license.self_generated.type:&amp;nbsp;basic&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;2）集群模式&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF; font-size: 16px;&quot;&gt;集群分为多种架构，不同架构每台节点的角色不同。es节点属于哪种角色[工种]由node.data和node.master两个参数确定，两个参数根据布尔值结果有四种组合，每一种组合都确定了一种角色。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;默认配置下节点同时为master和data角色，如果集群节点数不是特别多的话，比如三个es节点组成集群，这种模式可以减少运维成本。&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;混合模式：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cluster.name:&amp;nbsp;es-pre
node.name:&amp;nbsp;node-01
path.data:&amp;nbsp;/data/elasticsearch/data
path.logs:&amp;nbsp;/data/elasticsearch/logs
network.host:&amp;nbsp;0.0.0.0
http.port:&amp;nbsp;9200
discovery.seed_hosts:&amp;nbsp;[&amp;quot;172.31.71.134&amp;quot;,&amp;nbsp;&amp;quot;172.31.71.135&amp;quot;,&amp;quot;172.31.71.136&amp;quot;]
cluster.initial_master_nodes:&amp;nbsp;[&amp;quot;node-01&amp;quot;]
http.cors.enabled:&amp;nbsp;true
http.cors.allow-origin:&amp;nbsp;&amp;quot;*&amp;quot;
#&amp;nbsp;node.name:&amp;nbsp;node-1&amp;nbsp;&amp;nbsp;#&amp;nbsp;给Node起个名字,其他节点配置仅此参数不同node-1/node-2/node-3，其他都一样&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;data/master分离架构：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cluster.name:&amp;nbsp;es-cluster
node.name:&amp;nbsp;es-master01
path.data:&amp;nbsp;/data/elasticsearch/data
path.logs:&amp;nbsp;/data/elasticsearch/logs
network.host:&amp;nbsp;0.0.0.0
http.port:&amp;nbsp;9200
cluster.initial_master_nodes:&amp;nbsp;[&amp;quot;es-master01&amp;quot;,&amp;quot;es-master02&amp;quot;,&amp;quot;es-master03&amp;quot;]
discovery.seed_hosts:&amp;nbsp;[&amp;quot;192.168.10.21&amp;quot;,&amp;quot;192.168.10.22&amp;quot;,&amp;nbsp;&amp;quot;192.168.10.23&amp;quot;]
http.cors.enabled:&amp;nbsp;true
http.cors.allow-origin:&amp;nbsp;&amp;quot;*&amp;quot;
#&amp;nbsp;开启安全认证添加如下
xpack.security.enabled:&amp;nbsp;true
xpack.license.self_generated.type:&amp;nbsp;basic
xpack.security.transport.ssl.enabled:&amp;nbsp;true
xpack.security.transport.ssl.verification_mode:&amp;nbsp;certificate
xpack.security.transport.ssl.keystore.path:&amp;nbsp;elastic-certificates.p12
xpack.security.transport.ssl.truststore.path:&amp;nbsp;elastic-certificates.p12&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;除了node.name之外其他配置都一样&lt;/p&gt;&lt;p&gt;如集群节点数比较多，建议master单独部署。此时需要明确声明该节点的角色。&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1. master node：&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;node.master: true&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;node.data: false&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;2. data node:&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;node.master: false&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;node.data: true&lt;/p&gt;&lt;p&gt;默认情况下虽然没有配置这两个参数，实际上相当于两个参数都为true&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Sat, 07 Mar 2020 02:31:24 +0800</pubDate></item><item><title>elasticsearch ilm生命周期管理</title><link>http://pyops.net/?id=63</link><description>&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;索引生命周期管理 ILM: index lifecycle management&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;为了能够灵活地对索引数据的生命周期进行管理，我们需要结合生命周期策略[ILM policy]、索引模板[index template]、索引别名[index alias]、索引模式[index pattern]。如果只是正常工作，只需要创建一个策略，然后把索引关联到该策略即可。&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;为了方便观察，我新建一个策略只开启&lt;span style=&quot;color: #1A1C21; background-color: #FFFFFF; font-size: 1rem;&quot;&gt;Cold phase，需要的时候再开启删除操作。&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;color: #1A1C21; background-color: #FFFFFF; font-size: 16px;&quot;&gt;新建一条策略myilm：3天以前的索引进入cold阶段。&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;color: #1A1C21; background-color: #FFFFFF; font-size: 16px;&quot;&gt;&lt;/span&gt;&lt;h4 style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;color: #1A1C21; background-color: #FFFFFF; font-size: 16px;&quot;&gt;1. kibana给索引添加生命周期策略：&lt;/span&gt;&lt;/h4&gt;&lt;br/&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004231587637132594380.png&quot; alt=&quot;image.png&quot; width=&quot;754&quot; height=&quot;499&quot; style=&quot;width: 754px; height: 499px;&quot;/&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004231587637181272412.png&quot; alt=&quot;image.png&quot; width=&quot;519&quot; height=&quot;199&quot; style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; white-space: normal; widows: 1; width: 519px; height: 199px;&quot;/&gt;&lt;img src=&quot;http://pyops.net/zb_users/plugin/UEditor/themes/default/images/spacer.gif&quot; style=&quot;background:url(http://pyops.net/zb_users/plugin/UEditor/lang/zh-cn/images/localimage.png) no-repeat center center;border:1px solid #ddd&quot; word_img=&quot;file:///D:/Wiz_MyKnowledge/temp/9cb75d58-f756-4ab2-8add-fb48506363e0/128/index_files/45d60400-c79b-4caa-81c8-3d1469f93706.png&quot;/&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;可以看到添加策略的索引因为已经符合条件而打上了Frozen标签[我的操作时间是2020-04-23]&lt;/div&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004231587637224271412.png&quot; alt=&quot;image.png&quot;/&gt;&lt;img src=&quot;http://pyops.net/zb_users/plugin/UEditor/themes/default/images/spacer.gif&quot; style=&quot;background:url(http://pyops.net/zb_users/plugin/UEditor/lang/zh-cn/images/localimage.png) no-repeat center center;border:1px solid #ddd&quot; word_img=&quot;file:///D:/Wiz_MyKnowledge/temp/9cb75d58-f756-4ab2-8add-fb48506363e0/128/index_files/757cd719-67d6-4047-944d-6c334f314c76.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;2. 通过es API给索引添加生命周期策略：&lt;/h4&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;举例：索引&lt;span style=&quot;background-color: #FFFFFF;&quot;&gt;nginx-access-2020.04.16目前是没有添加任何生命周期策略的&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;[root@del620 ~]# curl -s es01:9200/nginx-access-2020.04.16/_settings|jq -e &amp;#39;.&amp;quot;nginx-access-2020.04.16&amp;quot;.settings.index.lifecycle.name&amp;#39;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;null&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/plugin/UEditor/themes/default/images/spacer.gif&quot; class=&quot;&quot; style=&quot;background:url(http://pyops.net/zb_users/plugin/UEditor/lang/zh-cn/images/localimage.png) no-repeat center center;border:1px solid #ddd&quot; word_img=&quot;file:///D:/Wiz_MyKnowledge/temp/9cb75d58-f756-4ab2-8add-fb48506363e0/128/index_files/2dc5bb4b-ebf7-40cc-84a5-5e859487c572.png&quot;/&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004231587637260322459.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;现在通过es的api添加策略：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;[root@del620 ~]# curl -H &amp;#39;Content-Type: application/json&amp;#39; -XPUT http://es01:9200/nginx-access-2020.04.16/_settings -d &amp;#39;{ &amp;quot;index&amp;quot;:{ &amp;quot;lifecycle&amp;quot;:{&amp;quot;name&amp;quot;:&amp;quot;myilm&amp;quot;}}}&amp;#39; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;{&amp;quot;acknowledged&amp;quot;:true}&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;再次查询检查策略是否添加：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;[root@del620 ~]# curl -s es01:9200/nginx-access-2020.04.16/_settings|jq -e &amp;#39;.&amp;quot;nginx-access-2020.04.16&amp;quot;.settings.index.lifecycle.name&amp;#39;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&amp;quot;myilm&amp;quot;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;查看详情：curl -s es01:9200/nginx-access-2020.04.16/_settings?pretty&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/plugin/UEditor/themes/default/images/spacer.gif&quot; class=&quot;&quot; style=&quot;background:url(http://pyops.net/zb_users/plugin/UEditor/lang/zh-cn/images/localimage.png) no-repeat center center;border:1px solid #ddd&quot; word_img=&quot;file:///D:/Wiz_MyKnowledge/temp/9cb75d58-f756-4ab2-8add-fb48506363e0/128/index_files/35f81d44-cda7-46c7-a597-369dada12494.png&quot;/&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004231587637276782794.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/div&gt;&lt;span style=&quot;color: #1A1C21; background-color: #FFFFFF; font-size: 1rem;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;其他更多高级技巧如前面提到的结合索引模板来管理多元化需求的索引，不同索引使用不同的策略等，后续有时间再来整理。&lt;/span&gt;&lt;/p&gt;</description><pubDate>Thu, 27 Feb 2020 22:30:30 +0800</pubDate></item><item><title>ELK/EFK--Linux系统日志收集</title><link>http://pyops.net/?id=62</link><description>&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;默认系统日志日期是不包含年的，为了方便采集到ELK，可以改成年月日的标准格式，看上去也更友好一些&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;Apr&amp;nbsp;16&amp;nbsp;22:10:01&amp;nbsp;dev01&amp;nbsp;systemd:&amp;nbsp;Started&amp;nbsp;Session&amp;nbsp;3197&amp;nbsp;of&amp;nbsp;user&amp;nbsp;root.
Apr&amp;nbsp;16&amp;nbsp;22:20:01&amp;nbsp;dev01&amp;nbsp;systemd:&amp;nbsp;Started&amp;nbsp;Session&amp;nbsp;3198&amp;nbsp;of&amp;nbsp;user&amp;nbsp;root.
Apr&amp;nbsp;16&amp;nbsp;22:30:01&amp;nbsp;dev01&amp;nbsp;systemd:&amp;nbsp;Started&amp;nbsp;Session&amp;nbsp;3199&amp;nbsp;of&amp;nbsp;user&amp;nbsp;root.&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;具体更改方法：&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cat&amp;nbsp;&amp;gt;&amp;nbsp;/etc/rsyslog.d/newdateformat.conf&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;\EOF
$template&amp;nbsp;myformat,&amp;quot;%$NOW%&amp;nbsp;%TIMESTAMP:8:15%&amp;nbsp;%HOSTNAME%&amp;nbsp;%syslogtag%&amp;nbsp;%msg%\n&amp;quot;
$ActionFileDefaultTemplate&amp;nbsp;myformat
EOF

systemctl&amp;nbsp;restart&amp;nbsp;rsyslog&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;修改后时间格式为：&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;2020-04-16&amp;nbsp;23:15:27&amp;nbsp;dev01&amp;nbsp;systemd:&amp;nbsp;Stopped&amp;nbsp;System&amp;nbsp;Logging&amp;nbsp;Service.
2020-04-16&amp;nbsp;23:15:27&amp;nbsp;dev01&amp;nbsp;systemd:&amp;nbsp;Starting&amp;nbsp;System&amp;nbsp;Logging&amp;nbsp;Service...&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;Logstash配置：因为不是json格式，所以需要grok模块对日志格式化匹配，然后使用date模块匹配日志里的时间格式：&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grok&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;{&amp;nbsp;&amp;quot;message&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;%{TIMESTAMP_ISO8601:syslogtime}&amp;quot;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;date&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;syslogtime&amp;quot;,&amp;nbsp;&amp;quot;yyyy-MM-dd&amp;nbsp;HH:mm:ss&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;target&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;@timestamp&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;filebeat配置：inputs.d/systemlog.yml&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/messages
&amp;nbsp;&amp;nbsp;exclude_lines:&amp;nbsp;&amp;#39;[[:graph:]&amp;nbsp;]+filebeat[[:graph:]&amp;nbsp;]+&amp;#39;
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;syslog&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;syslog
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;sys-messages

-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/secure
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;syslog&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;syslog
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;sys-secure&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;kibana日志展示：&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004171587116594192167.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;</description><pubDate>Thu, 27 Feb 2020 22:28:18 +0800</pubDate></item><item><title>ELK/EFK--Nginx日志收集</title><link>http://pyops.net/?id=61</link><description>&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;首先为了更适合ELK采集输出，把Nginx日志格式改成json格式输出：&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;log_format&amp;nbsp;&amp;nbsp;json&amp;nbsp;&amp;nbsp;&amp;#39;{&amp;nbsp;&amp;quot;@timestamp&amp;quot;:&amp;nbsp;&amp;quot;$time_iso8601&amp;quot;,&amp;quot;remote_addr&amp;quot;:&amp;nbsp;&amp;quot;$remote_addr&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;$request_method&amp;quot;,&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;&amp;quot;scheme&amp;quot;:&amp;quot;$scheme&amp;quot;,&amp;quot;host&amp;quot;:&amp;quot;$host&amp;quot;,&amp;quot;server_port&amp;quot;,&amp;quot;$server_port&amp;quot;,&amp;quot;request&amp;quot;:&amp;quot;$request_uri&amp;quot;,&amp;quot;status&amp;quot;:&amp;quot;$status&amp;quot;,&amp;nbsp;&amp;quot;body_size&amp;quot;:&amp;quot;$body_bytes_sent&amp;quot;,&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;&amp;quot;referer&amp;quot;:&amp;quot;$http_referer&amp;quot;,&amp;quot;ua&amp;quot;:&amp;quot;$http_user_agent&amp;quot;,&amp;quot;xff&amp;quot;:&amp;quot;$http_x_forwarded_for&amp;quot;,&amp;quot;up_addr&amp;quot;:&amp;quot;$upstream_addr&amp;quot;,&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;#39;&amp;quot;up_resp_time&amp;quot;:&amp;quot;$upstream_response_time&amp;quot;,&amp;quot;up_code&amp;quot;:&amp;quot;$upstream_status&amp;quot;,&amp;quot;rt&amp;quot;:&amp;quot;$request_time&amp;quot;}&amp;#39;;&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;关于Nginx的两种时间格式介绍：&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 16px;&quot;&gt;$time_iso8601&lt;/span&gt;&lt;br/&gt;&lt;/h4&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 16px;&quot;&gt;&amp;quot;2020-04-15T01:32:20+08:00&amp;quot;&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 16px;&quot;&gt;这种格式下对应的Logstash配置处理：&lt;/span&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 1rem;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;注意这里的时间格式可以选择$time_iso8601，刚好符合Logstash中date模块处理格式。输出的格式为：&amp;quot;2020-04-15T01:32:20+08:00&amp;quot;，Logstash配置里需要对此格式进行匹配：&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;date&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;timestamp&amp;quot;,&amp;nbsp;&amp;quot;yyyy-MM-dd&amp;#39;T&amp;#39;HH:mm:ssZZ&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;target&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;@timestamp&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;$time_local&lt;/span&gt;&lt;/h4&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;&amp;quot;08/Apr/2020:03:52:37 +0800&amp;quot;&lt;/span&gt;&lt;/div&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;这种格式下对应的Logstash配置处理：&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;date&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;timestamp&amp;quot;,&amp;nbsp;&amp;quot;dd/MMM/yyyy:HH:mm:ss&amp;nbsp;Z&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;target&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;@timestamp&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;/p&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;经过这样处理后kibana中显示的时间才能与日志的时间保持一致。对比两种格式使用iso8601更友好些.&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;/var/log/nginx/access.log：&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;{&amp;nbsp;&amp;quot;@timestamp&amp;quot;:&amp;nbsp;&amp;quot;2020-04-15T21:44:00+08:00&amp;quot;,&amp;quot;remote_addr&amp;quot;:&amp;nbsp;&amp;quot;192.168.10.27&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;GET&amp;quot;,&amp;quot;scheme&amp;quot;:&amp;quot;http&amp;quot;,&amp;quot;host&amp;quot;:&amp;quot;dev01&amp;quot;,&amp;quot;server_port&amp;quot;:80,&amp;quot;request&amp;quot;:&amp;quot;/img/header-background.png&amp;quot;,&amp;quot;status&amp;quot;:200,&amp;nbsp;&amp;quot;body_size&amp;quot;:82896,&amp;quot;referer&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;ua&amp;quot;:&amp;quot;curl/7.29.0&amp;quot;,&amp;quot;xff&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_addr&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_resp_time&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_code&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;rt&amp;quot;:0.000}
{&amp;nbsp;&amp;quot;@timestamp&amp;quot;:&amp;nbsp;&amp;quot;2020-04-15T21:44:01+08:00&amp;quot;,&amp;quot;remote_addr&amp;quot;:&amp;nbsp;&amp;quot;192.168.10.27&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;GET&amp;quot;,&amp;quot;scheme&amp;quot;:&amp;quot;http&amp;quot;,&amp;quot;host&amp;quot;:&amp;quot;dev01&amp;quot;,&amp;quot;server_port&amp;quot;:80,&amp;quot;request&amp;quot;:&amp;quot;/index.html&amp;quot;,&amp;quot;status&amp;quot;:200,&amp;nbsp;&amp;quot;body_size&amp;quot;:4833,&amp;quot;referer&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;ua&amp;quot;:&amp;quot;curl/7.29.0&amp;quot;,&amp;quot;xff&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_addr&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_resp_time&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_code&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;rt&amp;quot;:0.000}
{&amp;nbsp;&amp;quot;@timestamp&amp;quot;:&amp;nbsp;&amp;quot;2020-04-15T21:44:02+08:00&amp;quot;,&amp;quot;remote_addr&amp;quot;:&amp;nbsp;&amp;quot;192.168.10.27&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;GET&amp;quot;,&amp;quot;scheme&amp;quot;:&amp;quot;http&amp;quot;,&amp;quot;host&amp;quot;:&amp;quot;dev01&amp;quot;,&amp;quot;server_port&amp;quot;:80,&amp;quot;request&amp;quot;:&amp;quot;/img/header-background.png&amp;quot;,&amp;quot;status&amp;quot;:200,&amp;nbsp;&amp;quot;body_size&amp;quot;:82896,&amp;quot;referer&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;ua&amp;quot;:&amp;quot;curl/7.29.0&amp;quot;,&amp;quot;xff&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_addr&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_resp_time&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_code&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;rt&amp;quot;:0.000}
{&amp;nbsp;&amp;quot;@timestamp&amp;quot;:&amp;nbsp;&amp;quot;2020-04-15T21:44:03+08:00&amp;quot;,&amp;quot;remote_addr&amp;quot;:&amp;nbsp;&amp;quot;192.168.10.27&amp;quot;,&amp;quot;method&amp;quot;:&amp;quot;GET&amp;quot;,&amp;quot;scheme&amp;quot;:&amp;quot;http&amp;quot;,&amp;quot;host&amp;quot;:&amp;quot;dev01&amp;quot;,&amp;quot;server_port&amp;quot;:80,&amp;quot;request&amp;quot;:&amp;quot;/index.html&amp;quot;,&amp;quot;status&amp;quot;:200,&amp;nbsp;&amp;quot;body_size&amp;quot;:4833,&amp;quot;referer&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;ua&amp;quot;:&amp;quot;curl/7.29.0&amp;quot;,&amp;quot;xff&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_addr&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_resp_time&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;up_code&amp;quot;:&amp;quot;-&amp;quot;,&amp;quot;rt&amp;quot;:0.000}&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;安装filebeat后增加配置：inputs.d/nginx.yml:&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/nginx/access.log
&amp;nbsp;&amp;nbsp;json.keys_under_root:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;json.add_error_key:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;json.overwrite_keys:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;nginx_access&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;nginx
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;nginx_access
-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/nginx/error.log
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;nginx_error&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;nginx
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;nginx_error&lt;/pre&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;Logstash配置：这里贴的是全部的配置，重点关注这里跟Nginx相关的部分 [fields][logtype] == &amp;quot;nginx_access&amp;quot;：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;主配置：日志流处理，匹配时间格式&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;[root@logstash01 ~]# cat /etc/logstash/conf.d/main.conf&amp;nbsp;&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;input&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beats&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;port&amp;nbsp;=&amp;gt;&amp;nbsp;5000
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
filter&amp;nbsp;{
&amp;nbsp;&amp;nbsp;ruby&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;code&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;event.set(&amp;#39;myindex_date&amp;#39;,&amp;nbsp;event.get(&amp;#39;@timestamp&amp;#39;).time.localtime&amp;nbsp;+&amp;nbsp;8*60*60)&amp;quot;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;if&amp;nbsp;[fields][logtype]&amp;nbsp;==&amp;nbsp;&amp;quot;nginx_access&amp;quot;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;date&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;timestamp&amp;quot;,&amp;nbsp;&amp;quot;yyyy-MM-dd&amp;#39;T&amp;#39;HH:mm:ssZZ&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;target&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;@timestamp&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;if&amp;nbsp;[fields][svcname]&amp;nbsp;==&amp;nbsp;&amp;quot;syslog&amp;quot;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;grok&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;{&amp;nbsp;&amp;quot;message&amp;quot;&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;%{TIMESTAMP_ISO8601:syslogtime}&amp;quot;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;date&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;match&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;syslogtime&amp;quot;,&amp;nbsp;&amp;quot;yyyy-MM-dd&amp;nbsp;HH:mm:ss&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;target&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;@timestamp&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;[root@logstash01 ~]# cat /etc/logstash/conf.d/nginx.conf&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;output&amp;nbsp;{
&amp;nbsp;&amp;nbsp;if&amp;nbsp;[fields][logtype]&amp;nbsp;==&amp;nbsp;&amp;quot;nginx_access&amp;quot;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elasticsearch&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hosts&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;es01:9200&amp;quot;,&amp;quot;es02:9200&amp;quot;,&amp;quot;es03:9200&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;nginx-access-%{myindex_date}&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;if&amp;nbsp;[fields][logtype]&amp;nbsp;==&amp;nbsp;&amp;quot;nginx_error&amp;quot;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elasticsearch&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;hosts&amp;nbsp;=&amp;gt;&amp;nbsp;[&amp;quot;es01:9200&amp;quot;,&amp;quot;es02:9200&amp;quot;,&amp;quot;es03:9200&amp;quot;]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;index&amp;nbsp;=&amp;gt;&amp;nbsp;&amp;quot;nginx-error-%{myindex_date}&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;}
}&lt;/pre&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;kibana采集日志的展示：&lt;/div&gt;&lt;p&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004171587107732175705.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;通过截图显示可以看到Nginx中定义的key在这里也作为独立的fields。这里的@timestamp时间通过Logstash处理后跟日志里的时间保持一致了。但是截图里的Time和@timestamp的时间格式并不是Nginx日志中的格式，是因为kibana显示的原因，kibana还可以重新定义一次用于展示的时间格式。Nginx中的&lt;span style=&quot;font-size: 1rem; background-color: #FFFFFF;&quot;&gt;@timestamp实际是什么呢，我们来看下：&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;br/&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2020/04/202004171587107486432917.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/p&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;这个时间则是采集到的Nginx日志里的真实数据，不过为什么这里不是Nginx日志的原始数据，目前也还没弄明白。初步查了下，kibana的日期格式与Logstash有点区别，特别是时区。Logstash中date模块里[+08:00]用&amp;quot;ZZ&amp;quot;表示，而kibana则是用一个大写字母Z表示. 不知道是否跟这个有关系&lt;/div&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 27 Feb 2020 22:27:24 +0800</pubDate></item><item><title>Filebeat安装部署</title><link>http://pyops.net/?id=60</link><description>&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;下载安装&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;wget&amp;nbsp;https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/7.4.2/filebeat-7.4.2-x86_64.rpm
rpm&amp;nbsp;-ivh&amp;nbsp;filebeat-7.4.2-x86_64.rpm&lt;/pre&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;配置&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;mv&amp;nbsp;/etc/filebeat/filebeat.yml&amp;nbsp;/etc/filebeat/filebeat.yml.orig
cat&amp;nbsp;&amp;gt;&amp;nbsp;/etc/filebeat/filebeat.yml&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;\EOF
filebeat.config.inputs:
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;path:&amp;nbsp;inputs.d/*.yml
filebeat.config.modules:
&amp;nbsp;&amp;nbsp;path:&amp;nbsp;${path.config}/modules.d/*.yml
&amp;nbsp;&amp;nbsp;reload.enabled:&amp;nbsp;false
setup.template.settings:
&amp;nbsp;&amp;nbsp;index.number_of_shards:&amp;nbsp;1
max_procs:&amp;nbsp;1
queue.mem:
&amp;nbsp;&amp;nbsp;events:&amp;nbsp;4096
&amp;nbsp;&amp;nbsp;flush.min_events:&amp;nbsp;2048
&amp;nbsp;&amp;nbsp;flush.timeout:&amp;nbsp;5s
setup.ilm.enabled:&amp;nbsp;false
output.logstash:
&amp;nbsp;&amp;nbsp;hosts:&amp;nbsp;[&amp;quot;192.168.10.27:5000&amp;quot;]
&amp;nbsp;&amp;nbsp;#loadbalance:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;#compression_level:&amp;nbsp;6
processors:
&amp;nbsp;&amp;nbsp;-&amp;nbsp;add_host_metadata:&amp;nbsp;~
&amp;nbsp;&amp;nbsp;-&amp;nbsp;add_cloud_metadata:&amp;nbsp;~

EOF

#&amp;nbsp;说明:
192.168.10.27:5000&amp;nbsp;--&amp;nbsp;Logstash的地址和端口
filebeat.yml里的配置参数详细解说在以后介绍,这里的部分配置只是确保服务能正常启动,没有收集任何日志信息.&lt;/pre&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;filebeat.yml配置内容可以保证服务正常启动，但是没有采集应用日志相关配置，下面以nginx应用作为应用采集配置作为举例讲解：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;inputs.d/nginx.yml:&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/nginx/access.log
&amp;nbsp;&amp;nbsp;json.keys_under_root:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;json.add_error_key:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;json.overwrite_keys:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;nginx_access&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;nginx
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;nginx_access
-&amp;nbsp;type:&amp;nbsp;log&amp;nbsp;
&amp;nbsp;&amp;nbsp;enabled:&amp;nbsp;true&amp;nbsp;
&amp;nbsp;&amp;nbsp;paths:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-&amp;nbsp;/var/log/nginx/error.log
&amp;nbsp;&amp;nbsp;tags:&amp;nbsp;[&amp;quot;nginx_error&amp;quot;]
&amp;nbsp;&amp;nbsp;fields:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;svcname:&amp;nbsp;nginx
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;logtype:&amp;nbsp;nginx_error&lt;/pre&gt;&lt;h4&gt;服务启停&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;为了简便,给服务起一个简短的名称,在/usr/lib/systemd/system/filebeat.service中添加别名:
[Install]
Alias=fb.service

#&amp;nbsp;让别名生效
systemctl&amp;nbsp;enable&amp;nbsp;filebeat
systemctl&amp;nbsp;start&amp;nbsp;fb&lt;/pre&gt;&lt;h4&gt;验证服务&lt;br/&gt;&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;首先查看agent进程是否正常启动
systemctl&amp;nbsp;status&amp;nbsp;filebeat&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 27 Feb 2020 22:26:32 +0800</pubDate></item><item><title>Logstash安装部署</title><link>http://pyops.net/?id=59</link><description>&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;下载安装&lt;/span&gt;&lt;/h4&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;Logstash组件的运行需要java，因此必须先安装JDK组件。&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;安装JDK
wget&amp;nbsp;https://mirrors.huaweicloud.com/java/jdk/11.0.2+9/jdk-11.0.2_linux-x64_bin.tar.gz

tar&amp;nbsp;xf&amp;nbsp;jdk-11.0.2_linux-x64_bin.tar.gz&amp;nbsp;-C&amp;nbsp;/usr/local/src/
ln&amp;nbsp;-s&amp;nbsp;/usr/local/src/jdk-11.0.2&amp;nbsp;/usr/local/jdk
ln&amp;nbsp;-s&amp;nbsp;/usr/local/jdk/bin/java&amp;nbsp;&amp;nbsp;/usr/bin/&amp;nbsp;#&amp;nbsp;必须执行这一条,否则systemd启动服务找不到JAVA_HOME
cat&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/profile&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;\EOF
export&amp;nbsp;JAVA_HOME=/usr/local/jdk
export&amp;nbsp;PATH=$JAVA_HOME/bin:$PATH
EOF

#&amp;nbsp;安装logstash

wget&amp;nbsp;https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum/7.4.2/logstash-7.4.2.rpm
rpm&amp;nbsp;-ivh&amp;nbsp;logstash-7.4.2.rpm&lt;/pre&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;配置&lt;/span&gt;&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;mkdir&amp;nbsp;-p&amp;nbsp;/data/logstash/{data,logs}&amp;nbsp;&amp;amp;&amp;amp;&amp;nbsp;chown&amp;nbsp;logstash.logstash&amp;nbsp;-R&amp;nbsp;/data/logstash
#&amp;nbsp;软件配置
mv&amp;nbsp;/etc/logstash/logstash.yml&amp;nbsp;/etc/logstash/logstash.yml.orig
cat&amp;nbsp;&amp;gt;&amp;nbsp;/etc/logstash/logstash.yml&amp;nbsp;&amp;lt;&amp;lt;&amp;nbsp;EOF
path.data:&amp;nbsp;/data/logstash
path.logs:&amp;nbsp;/data/logstash/logs
xpack.monitoring.enabled:&amp;nbsp;true
xpack.monitoring.elasticsearch.hosts:&amp;nbsp;[&amp;quot;http://localhost:9200&amp;quot;]
#xpack.monitoring.elasticsearch.username:&amp;nbsp;logstash_system
#xpack.monitoring.elasticsearch.password:&amp;nbsp;kb2019
EOF
#&amp;nbsp;应用配置：所有.conf配置文件都放在目录/etc/logstash/conf.d
#&amp;nbsp;conf配置文件结构大致上是input{}、filter{}、output{}
#&amp;nbsp;主配置:&amp;nbsp;logstash-main.conf,&amp;nbsp;应用配置app1.conf/app2.conf/...来配置不同应用的输出,&amp;nbsp;非常方便扩展,&amp;nbsp;后续添加应用只要拷贝一个模板修改一下应用名关键字即可.
#&amp;nbsp;为了让logstash服务正常能够启动,我们需要添加Input{}&amp;nbsp;部分监听端口:
cat&amp;nbsp;&amp;gt;/etc/logstash/conf.d/logstash-main.conf&amp;nbsp;&amp;lt;&amp;lt;EOF
input&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;beats&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;port&amp;nbsp;=&amp;gt;&amp;nbsp;5000
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
}
EOF&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;font-size: 16px;&quot;&gt;服务启停&lt;/span&gt;&lt;/h4&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;systemctl&amp;nbsp;restart&amp;nbsp;logstash

#&amp;nbsp;服务检测:&amp;nbsp;服务启动后有个一二十秒后会监听端口[5000是默认,可以自定义;9600则是服务自身用不对外开放]
[root@logstash01&amp;nbsp;bin]#&amp;nbsp;ss&amp;nbsp;-ltn&amp;nbsp;|egrep&amp;nbsp;&amp;quot;5000|9600&amp;quot;
LISTEN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;128&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:::5000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:::*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
LISTEN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;::ffff:127.0.0.1:9600&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:::*&lt;/pre&gt;&lt;h4 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.17rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;background-color: #FFFFFF; font-size: 16px;&quot;&gt;常见安装错误.&lt;/span&gt;&lt;/h4&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;常见错误1：缺少配置文件，服务不停地重启&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;Apr&amp;nbsp;&amp;nbsp;5&amp;nbsp;20:33:08&amp;nbsp;logstash01&amp;nbsp;logstash:&amp;nbsp;[2020-04-05T20:33:08,761][INFO&amp;nbsp;][logstash.config.source.local.configpathloader]&amp;nbsp;No&amp;nbsp;config&amp;nbsp;files&amp;nbsp;found&amp;nbsp;in&amp;nbsp;path&amp;nbsp;{:path=&amp;gt;&amp;quot;/etc/logstash/conf.d/*.conf&amp;quot;}
Apr&amp;nbsp;&amp;nbsp;5&amp;nbsp;20:33:08&amp;nbsp;logstash01&amp;nbsp;logstash:&amp;nbsp;[2020-04-05T20:33:08,807][ERROR][logstash.config.sourceloader]&amp;nbsp;No&amp;nbsp;configuration&amp;nbsp;found&amp;nbsp;in&amp;nbsp;the&amp;nbsp;configured&amp;nbsp;sources.
Apr&amp;nbsp;&amp;nbsp;5&amp;nbsp;20:33:09&amp;nbsp;logstash01&amp;nbsp;logstash:&amp;nbsp;[2020-04-05T20:33:09,152][INFO&amp;nbsp;][logstash.agent&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&amp;nbsp;Successfully&amp;nbsp;started&amp;nbsp;Logstash&amp;nbsp;API&amp;nbsp;endpoint&amp;nbsp;{:port=&amp;gt;9600}
Apr&amp;nbsp;&amp;nbsp;5&amp;nbsp;20:33:14&amp;nbsp;logstash01&amp;nbsp;logstash:&amp;nbsp;[2020-04-05T20:33:14,020][INFO&amp;nbsp;][logstash.runner&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;]&amp;nbsp;Logstash&amp;nbsp;shut&amp;nbsp;down.&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;常见错误2：通过systemctl start logstash发现启动失败，通过查看/var/log/message日志发现居然找不到JAVA_HOME环境变量[已在/etc/profile添加过]&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;logstash:&amp;nbsp;could&amp;nbsp;not&amp;nbsp;find&amp;nbsp;java;&amp;nbsp;set&amp;nbsp;JAVA_HOME&amp;nbsp;or&amp;nbsp;ensure&amp;nbsp;java&amp;nbsp;is&amp;nbsp;in&amp;nbsp;PATH
Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;systemd:&amp;nbsp;logstash.service:&amp;nbsp;main&amp;nbsp;process&amp;nbsp;exited,&amp;nbsp;code=exited,&amp;nbsp;status=1/FAILURE
Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;systemd:&amp;nbsp;Unit&amp;nbsp;logstash.service&amp;nbsp;entered&amp;nbsp;failed&amp;nbsp;state.
Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;systemd:&amp;nbsp;logstash.service&amp;nbsp;failed.
Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;systemd:&amp;nbsp;logstash.service&amp;nbsp;holdoff&amp;nbsp;time&amp;nbsp;over,&amp;nbsp;scheduling&amp;nbsp;restart.
Apr&amp;nbsp;&amp;nbsp;8&amp;nbsp;22:24:40&amp;nbsp;logstash01&amp;nbsp;systemd:&amp;nbsp;Stopped&amp;nbsp;logstash.&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;后查找原因是因为systemd service不会去查找/etc/profile文件,由systemd自定义的环境文件定义. 解决办法有许多，介绍几种：&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;1)&amp;nbsp;给systemd&amp;nbsp;service里的Environment=/etc/default/logstash里添加JAVA_HOME变量:
echo&amp;nbsp;&amp;quot;JAVA_HOME=/usr/local/jdk&amp;quot;&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/default/logstash
2)&amp;nbsp;脚本/usr/share/logstash/bin/logstash.lib.sh首行加入JAVA环境
JAVA_HOME=/usr/local/jdk
3)&amp;nbsp;添加java软连接到系统默认PATH变量路径里:
ln&amp;nbsp;-s&amp;nbsp;/usr/local/jdk/bin/java&amp;nbsp;/usr/bin/
推荐第三种方案一劳永逸&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Thu, 27 Feb 2020 22:26:06 +0800</pubDate></item><item><title>haproxy之cookie</title><link>http://pyops.net/?id=56</link><description>&lt;h3 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.25rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;一. 环境：&lt;/h3&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;line-height: 1.7;&quot;&gt;在自己的k8s上新建了几个容器：[这块可以忽略...]&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@master01&amp;nbsp;k8s]#&amp;nbsp;kubectl&amp;nbsp;get&amp;nbsp;pod&amp;nbsp;-o&amp;nbsp;wide
NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;READY&amp;nbsp;&amp;nbsp;&amp;nbsp;STATUS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RESTARTS&amp;nbsp;&amp;nbsp;&amp;nbsp;AGE&amp;nbsp;&amp;nbsp;&amp;nbsp;IP&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NODE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NOMINATED&amp;nbsp;NODE&amp;nbsp;&amp;nbsp;&amp;nbsp;READINESS&amp;nbsp;GATES
haproxy-01&amp;nbsp;&amp;nbsp;&amp;nbsp;1/1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Running&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;14h&amp;nbsp;&amp;nbsp;&amp;nbsp;10.2.77.4&amp;nbsp;&amp;nbsp;&amp;nbsp;192.168.10.95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;
tomcat-01&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Running&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;17h&amp;nbsp;&amp;nbsp;&amp;nbsp;10.2.77.3&amp;nbsp;&amp;nbsp;&amp;nbsp;192.168.10.95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;
tomcat-02&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1/1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Running&amp;nbsp;&amp;nbsp;&amp;nbsp;0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;16h&amp;nbsp;&amp;nbsp;&amp;nbsp;10.2.77.5&amp;nbsp;&amp;nbsp;&amp;nbsp;192.168.10.95&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;none&amp;gt;

[root@master01&amp;nbsp;k8s]#&amp;nbsp;cat&amp;nbsp;tomcat.yaml&amp;nbsp;
apiVersion:&amp;nbsp;v1
kind:&amp;nbsp;Pod
metadata:
&amp;nbsp;&amp;nbsp;name:&amp;nbsp;tomcat-01
spec:
&amp;nbsp;&amp;nbsp;containers:
&amp;nbsp;&amp;nbsp;-&amp;nbsp;name:&amp;nbsp;tomcat-01
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;securityContext:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;privileged:&amp;nbsp;true
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;image:&amp;nbsp;192.168.10.103/public/sshd-base:latest
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;imagePullPolicy:&amp;nbsp;Always
&amp;nbsp;&amp;nbsp;imagePullSecrets:
&amp;nbsp;&amp;nbsp;-&amp;nbsp;name:&amp;nbsp;mysecret&lt;/pre&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;haproxy：10.2.77.4&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;tomcat01：10.2.77.3&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;tomcat02：10.2.77.5&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;OS：centos7u6&lt;/div&gt;&lt;p style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;&lt;span style=&quot;line-height: 1.7;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.25rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;二. 后端服务部署&lt;/h3&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;服务基于Tomcat的动态jsp请求，tomcat基于java，需要先把java环境部署，具体步骤就不介绍了。&lt;/div&gt;&lt;h5 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: bold; font-size: 1rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;1. JAVA环境：&lt;/h5&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;/etc/profile：中加入环境变量
export&amp;nbsp;JAVA_HOME=/usr/local/jdk
export&amp;nbsp;PATH=$JAVA_HOME/bin:$PATH

[root@tomcat-01&amp;nbsp;~]#&amp;nbsp;java&amp;nbsp;-version
java&amp;nbsp;version&amp;nbsp;&amp;quot;1.8.0_221&amp;quot;
Java(TM)&amp;nbsp;SE&amp;nbsp;Runtime&amp;nbsp;Environment&amp;nbsp;(build&amp;nbsp;1.8.0_221-b11)
Java&amp;nbsp;HotSpot(TM)&amp;nbsp;64-Bit&amp;nbsp;Server&amp;nbsp;VM&amp;nbsp;(build&amp;nbsp;25.221-b11,&amp;nbsp;mixed&amp;nbsp;mode)&lt;/pre&gt;&lt;h5 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-weight: bold; font-size: 1rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;2. tomcat安装：&lt;/h5&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;Tomcat下载：&lt;a href=&quot;http://tomcat.apache.org/download-80.cgi&quot; style=&quot;word-wrap: break-word;&quot;&gt;http://tomcat.apache.org/download-80.cgi&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;使用二进制方式安装：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.43/bin/apache-tomcat-8.5.43.tar.gz&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;tar zxf apache-tomcat-8.5.43.tar.gz&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;mv apache-tomcat-8.5.43 /usr/local/src/&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;ln -s /usr/local/src/apache-tomcat-8.5.43 /usr/local/tomcat&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;启动：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;cd /usr/local/tomcat/bin&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;./startup.sh&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;测试：&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;curl 127.0.0.1:8080&lt;/div&gt;&lt;div style=&quot;margin: 8px 0px; font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; white-space: normal; widows: 1;&quot;&gt;返回结果正常，另外一台同样的安装即可。为了方便测试，修改默认首页index.jsp为&amp;quot;tomcat01&amp;quot;和&amp;quot;tomcat02&amp;quot;&lt;/div&gt;&lt;h3 style=&quot;margin-top: 1.25rem; margin-right: 0px; margin-bottom: 0.625rem; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; font-size: 1.25rem; color: rgb(0, 0, 0); font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-variant-numeric: normal; font-variant-east-asian: normal; white-space: normal; widows: 1;&quot;&gt;三. haproxy安装配置&lt;/h3&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;yum&amp;nbsp;install&amp;nbsp;-y&amp;nbsp;haproxy&lt;/pre&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@haproxy-01&amp;nbsp;haproxy]#&amp;nbsp;cat&amp;nbsp;haproxy.cfg
global
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;maxconn&amp;nbsp;30000
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;user&amp;nbsp;haproxy
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pidfile&amp;nbsp;/var/run/haproxy.pid
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;log&amp;nbsp;127.0.0.1&amp;nbsp;local0&amp;nbsp;info
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;log&amp;nbsp;127.0.0.1&amp;nbsp;local1&amp;nbsp;warning

defaults
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;mode&amp;nbsp;http
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;log&amp;nbsp;global
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;option&amp;nbsp;http-keep-alive
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;option&amp;nbsp;forwardfor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;option&amp;nbsp;httplog
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timeout&amp;nbsp;connect&amp;nbsp;5000ms
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timeout&amp;nbsp;client&amp;nbsp;10000ms
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timeout&amp;nbsp;server&amp;nbsp;50000ms
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;timeout&amp;nbsp;http-request&amp;nbsp;20000ms
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;option&amp;nbsp;httpchk&amp;nbsp;GET&amp;nbsp;/healthCheck.html

frontend&amp;nbsp;http-in
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bind&amp;nbsp;*:80
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;maxconn&amp;nbsp;30000
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default_backend&amp;nbsp;bk_tomcat

backend&amp;nbsp;bk_tomcat&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;balance&amp;nbsp;roundrobin
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;cookie&amp;nbsp;c_serverid&amp;nbsp;insert&amp;nbsp;indirect&amp;nbsp;nocache
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;tomcat01&amp;nbsp;10.2.77.3:8080&amp;nbsp;check&amp;nbsp;cookie&amp;nbsp;tomcat01
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;server&amp;nbsp;tomcat02&amp;nbsp;10.2.77.5:8080&amp;nbsp;check&amp;nbsp;cookie&amp;nbsp;tomcat02

listen&amp;nbsp;stats
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;bind&amp;nbsp;*:9001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stats&amp;nbsp;refresh&amp;nbsp;30s&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stats&amp;nbsp;uri&amp;nbsp;/stats&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stats&amp;nbsp;realm&amp;nbsp;HAProxy\&amp;nbsp;Stats
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stats&amp;nbsp;auth&amp;nbsp;admin:admin&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;默认请求：/index.jsp，后文将省略index.jsp。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565710192672410.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;第一个请求：请求头没有任何额外的信息，haproxy检测到请求头没有对应的cookie，所以响应头被haproxy插入了设定好的cookie：c_serverid=tomcat01，说明选择的backend server是tomcat01，后续请求都将转发到此server&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565711111824325.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;第二个请求：可以看到请求头cookie中已经附上了前面请求中haproxy插入的信息，haproxy识别后将请求转发到标记的后端服务器，这样就能一直保持转发到相同服务器&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565711167148533.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;后续请求都是转发到相同服务器了。注意到整个过程中Tomcat的创建的JSESSIONID也没有变过。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565710349484529.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;用curl来测试一下：&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565710499231918.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565711461891969.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; widows: 1;&quot;&gt;虽然haproxy在响应头里插入了cookie，但是由于&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; widows: 1; background-color: #FFFFFF;&quot;&gt;curl都是一次性请求连接就断开，默认也没有附上cookie，所以是轮询的。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 1rem; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;下面在请求中带上cookie试试：&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565711637837875.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;可以看到带上cookie信息后转发到了固定的后端服务器，多请求测试一下：&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;img src=&quot;http://pyops.net/zb_users/upload/2019/08/201908131565711674115001.png&quot; alt=&quot;image.png&quot;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;&lt;span style=&quot;font-family: Helvetica, &amp;quot;Hiragino Sans GB&amp;quot;, 微软雅黑, &amp;quot;Microsoft YaHei UI&amp;quot;, SimSun, SimHei, arial, sans-serif; font-size: 16px; font-variant-numeric: normal; font-variant-east-asian: normal; line-height: 27.2px; widows: 1; background-color: #FFFFFF;&quot;&gt;可以看到都是转发到相同的后端了。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description><pubDate>Tue, 13 Aug 2019 23:09:11 +0800</pubDate></item><item><title>统计nginx日志中url的平均响应时间</title><link>http://pyops.net/?id=55</link><description>&lt;p&gt;假设日志内容如下，第二列代表响应时间，单位ms：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@ecs01&amp;nbsp;logs]#&amp;nbsp;cat&amp;nbsp;test.log&amp;nbsp;
http://www.baidu.com/&amp;nbsp;&amp;nbsp;&amp;nbsp;34
http://www.taobao.com/&amp;nbsp;&amp;nbsp;10
http://www.baidu.com/&amp;nbsp;&amp;nbsp;&amp;nbsp;27
http://www.taobao.com/&amp;nbsp;&amp;nbsp;12&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;现在需要统计各个url的平均响应时间，并按照递减顺序排名，一条命令如何实现：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@ecs01&amp;nbsp;logs]#&amp;nbsp;cat&amp;nbsp;test.log&amp;nbsp;|awk&amp;nbsp;&amp;#39;{url[$1]+=$2;curl[$1]++}END{for(i&amp;nbsp;in&amp;nbsp;url)for(c&amp;nbsp;in&amp;nbsp;curl)if&amp;nbsp;(c=i)&amp;nbsp;print&amp;nbsp;c,url[i]/curl[c]}&amp;#39;|uniq|sort&amp;nbsp;-k2&amp;nbsp;-rn
http://www.baidu.com/&amp;nbsp;30.5
http://www.taobao.com/&amp;nbsp;11&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;p&gt;拿自己的网站日志测试下：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@ecs01&amp;nbsp;logs]#&amp;nbsp;tail&amp;nbsp;access.log&amp;nbsp;-n200|awk&amp;nbsp;-F&amp;#39;[&amp;quot;&amp;nbsp;]+&amp;#39;&amp;nbsp;&amp;#39;{url[$7]+=$9;curl[$7]++}END{for(i&amp;nbsp;in&amp;nbsp;url)for(c&amp;nbsp;in&amp;nbsp;curl)if&amp;nbsp;(c=i)&amp;nbsp;print&amp;nbsp;c,url[i]/curl[c]}&amp;#39;|uniq|sort&amp;nbsp;-k2&amp;nbsp;-rn|head
http://pyops.net/zb_users/theme/koilee/style/style.css&amp;nbsp;139511
http://pyops.net/?id=51&amp;nbsp;94067
http://pyops.net/zb_system/script/jquery-2.2.4.min.js&amp;nbsp;85578
http://pyops.net/zb_users/upload/2019/05/201905141557772239461811.jpg&amp;nbsp;83907
http://pyops.net/zb_users/theme/koilee/style/style.css&amp;nbsp;69755.5
http://pyops.net/zb_users/plugin/UEditor/third-party/prism/prism.js&amp;nbsp;61083
http://pyops.net/zb_users/plugin/UEditor/third-party/prism/prism.js&amp;nbsp;61083
http://pyops.net/?id=33&amp;nbsp;52397
http://pyops.net/zb_users/theme/koilee/script/swiper.min.js&amp;nbsp;51247
http://pyops.net/zb_users/theme/koilee/script/swiper.min.js&amp;nbsp;51247&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Wed, 29 May 2019 13:37:21 +0800</pubDate></item></channel></rss><!--28.96 ms , 6 query , 3874kb memory , 0 error-->