<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title><![CDATA[运维知识库]]></title> 
<atom:link href="https://www.oame2024.cn/rss.php" rel="self" type="application/rss+xml" />
<description><![CDATA[KnowledgeBase for Works]]></description>
<link>https://www.oame2024.cn/</link>
<language>zh-cn</language>
<generator>www.emlog.net</generator>
<item>
    <title>主流Linux操作系统各版本网卡配置方法</title>
    <link>https://www.oame2024.cn/?post=16</link>
    <description><![CDATA[<hr />
<h2>title: 主流Linux操作系统各版本网卡配置方法<br />
date: 2025-05-22T13:26:08Z<br />
lastmod: 2025-05-22T13:42:21Z</h2>
<h1>主流Linux操作系统各版本网卡配置方法</h1>
<p>国产系统麒麟V10，openEuler等都是基于Redhat系列开发的，网卡配置与其对应版本配置方法相同</p>
<ol>
<li>CentOS/RHEL 系列</li>
</ol>
<p>1.1  CentOS6/RHEL 6：基于 ifcfg-ethX 文件（传统方式）</p>
<p>配置文件路径：</p>
<p>/etc/sysconfig/network-scripts/ifcfg-eth0<br />
主要配置及注释：</p>
<blockquote>
<p>DEVICE=eth0                              # 网络接口名称，通常为 ethX，必须指定<br />
HWADDR=00:0C:29:3E:53:7E     # 网卡 MAC 地址（可选），可用于绑定特定设备<br />
TYPE=Ethernet                           # 连接类型，通常为 Ethernet<br />
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx # 唯一标识符（可选）</p>
<p>‍</p>
<p>ONBOOT=yes                            # 是否在系统启动时自动启用该接口<br />
BOOTPROTO=static                   # 启动时使用的协议类型：static（静态IP）、dhcp、none<br />
IPADDR=10.0.0.100                   # 静态 IP 地址<br />
NETMASK=255.255.255.0         # 子网掩码<br />
GATEWAY=10.0.0.2                   # 默认网关<br />
DNS1=8.8.8.8                            # 主 DNS 服务器<br />
DNS2=114.114.114.114            # 备 DNS 服务器（可选）</p>
</blockquote>
<p>重启网卡信息</p>
<p>service network restart  </p>
<p>查看网卡状态：该命令适用所有Linux系统</p>
<blockquote>
<p>ifconfig</p>
</blockquote>
<p>1.2 CentOS 7 / RHEL 7：仍支持 ifcfg-*，也支持 nmcli 管理</p>
<p>配置文件路径：</p>
<blockquote>
<p>/etc/sysconfig/network-scripts/ifcfg-ens33</p>
</blockquote>
<p>接口名已使用 predictable network names，如 ens33, enp0s3 等。</p>
<p>主要配置及注释：</p>
<blockquote>
<p>TYPE=Ethernet              # 网络类型<br />
BOOTPROTO=none       # 启动协议方式，none 表示不使用 DHCP,也可以static<br />
NAME=ens33                # 接口名称<br />
DEVICE=ens33              # 同上，必须匹配网卡名称<br />
ONBOOT=yes               # 开机自动启动网络<br />
IPADDR=10.0.0.100      # 静态 IP 地址<br />
PREFIX=24                    # 子网前缀长度（等价于子网掩码 255.255.255.0）<br />
GATEWAY=10.0.0.2       # 默认网关<br />
DNS1=8.8.8.8               # 主 DNS<br />
DNS2=1.1.1.1               # 备 DNS</p>
</blockquote>
<p>启用配置：</p>
<blockquote>
<p>systemctl restart network</p>
</blockquote>
<p>1.3 CentOS 8 / RHEL 8：推荐使用 nmcli 或 nmtui 配置（仍支持 ifcfg）</p>
<p>使用 nmcli 命令配置静态 IP：</p>
<blockquote>
<p>nmcli con add con-name &lt;连接名&gt; ifname &lt;网卡名&gt; type &lt;连接类型&gt; ipv4.method manual ipv4.addresses &lt;ipv4地址&gt; ipv4.gateway &lt;ipv4网关地址&gt; ipv4.dns &lt;ipv4 dns服务器&gt;</p>
<p>‍</p>
<p>nmcli con mod static-ens33 ipv4.dns &quot;8.8.8.8 1.1.1.1&quot;<br />
nmcli con mod static-ens33 ipv4.method manual<br />
nmcli con up static-ens33<br />
nmcli con down static-ens33</p>
</blockquote>
<p>参数解释：</p>
<blockquote>
<p>•  con-name：连接名称，可自定义</p>
<p>•  type：网络类型，如 ethernet, wifi</p>
<p>•  ifname：网卡接口名（如 ens33）</p>
<p>•  ipv4.addresses：静态 IP 地址 + 子网前缀</p>
<p>•  ipv4.gateway：IPv4 网关</p>
<p>•  ipv4.dns：DNS 服务器地址</p>
<p>•  ipv4.method manual：设置为静态 IP</p>
</blockquote>
<p>使用nmtui可以直接进入图形化界面配置</p>
<p><img src="assets/bc3b3f97c4859db6ddb817b08c236ff3-20250522133329-bnm851j.png" alt="bc3b3f97c4859db6ddb817b08c236ff3" /></p>
<ol start="2">
<li>Debian / Ubuntu 系列</li>
</ol>
<p>2.1 Ubuntu 16.04 及 Debian 9 及以前：使用 /etc/network/interfaces</p>
<p>配置文件路径：</p>
<blockquote>
<p>/etc/network/interfaces</p>
</blockquote>
<p>主要配置及注释：</p>
<blockquote>
<p>auto eth0                             # 设置 eth0 在开机时自动启用<br />
iface eth0 inet static            # 为 eth0 指定 IPv4 静态配置，dhcp为自动获取，下面的就不用配置了<br />
address 10.0.0.100           # 静态 IP 地址<br />
netmask 255.255.255.0    # 子网掩码<br />
gateway 10.0.0.2              # 默认网关<br />
dns-nameservers 8.8.8.8 114.114.114.114    # DNS 服务器（空格分隔多个）</p>
</blockquote>
<p>启用配置：</p>
<blockquote>
<p>sudo systemctl restart networking</p>
</blockquote>
<p>2.2 Ubuntu 18.04+ / Debian 10+：使用 netplan</p>
<p>配置文件路径：</p>
<blockquote>
<p>/etc/netplan/01-netcfg.yaml</p>
</blockquote>
<p>Ubuntu 18.04开始是使用yaml格式的配置，需要遵循yaml格式规范，注意缩进</p>
<p>YAML 主要配置及注释：</p>
<blockquote>
<p>network:<br />
version: 2                        # netplan 配置语法版本，固定为 2<br />
renderer: networkd        # 使用 systemd-networkd 作为后台渲染器（也可为 NetworkManager）<br />
ethernets:<br />
ens33:                           # 网卡接口名<br />
dhcp4: no                   # 不启用 DHCP（启用时为 yes）<br />
addresses:  </p>
<ul>
<li>10.0.0.100/24         # 静态 IP 地址及子网前缀<br />
gateway4: 10.0.0.2     # 默认网关<br />
nameservers:<br />
addresses:  
<ul>
<li>8.8.8.8                  # 主 DNS  </li>
<li>223.5.5.5              # 备用 DNS</li>
</ul></li>
</ul>
</blockquote>
<p>应用配置：</p>
<blockquote>
<p>sudo netplan apply</p>
</blockquote>
<ol start="3">
<li>
<p>使用 ip 命令临时配置（适用于所有版本）</p>
<blockquote>
<p>ip addr add 192.168.1.100/24 dev ens33         # 添加 IP 地址<br />
ip link set ens33 up                                          # 启用网卡<br />
ip route add default via 192.168.1.1                # 设置默认路由</p>
</blockquote>
<p>⚠️ 临时生效，重启后失效，常用于测试。</p>
</li>
<li>
<p>4 总结对比表</p>
<table>
<thead>
<tr>
<th>系统版本</th>
<th>配置方式</th>
<th>配置文件或工具</th>
</tr>
</thead>
<tbody>
<tr>
<td>CentOS/RHEL 6</td>
<td>ifcfg</td>
<td>/etc/sysconfig/network-scripts/ifcfg-*</td>
</tr>
<tr>
<td>CentOS/RHEL 7</td>
<td>ifcfg+NetworkManager</td>
<td>同上 + nmcli / nmtui</td>
</tr>
<tr>
<td>CentOS/RHEL 8</td>
<td>推荐使用 NetworkManager</td>
<td>nmcli  / nmtui + 可选 ifcfg 文件</td>
</tr>
<tr>
<td>Ubuntu &lt;=16.04</td>
<td>interfaces</td>
<td>/etc/network/interfaces</td>
</tr>
<tr>
<td>Ubuntu &gt;=18.04</td>
<td>netplan</td>
<td>/etc/netplan/*.yaml</td>
</tr>
<tr>
<td>Debian &lt;=9</td>
<td>interfaces</td>
<td>/etc/network/interfaces</td>
</tr>
<tr>
<td>Debian &gt;=10</td>
<td>netplan</td>
<td>/etc/netplan/*.yaml</td>
</tr>
</tbody>
</table>
</li>
</ol>
<p>‍</p>]]></description>
    <pubDate>Thu, 22 May 2025 13:43:42 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=16</guid>
</item>
<item>
    <title>Centos 7.9 2202安装部署Zabbix 6.4.20</title>
    <link>https://www.oame2024.cn/?post=15</link>
    <description><![CDATA[<h1>【已审核】【部署】Centos 7.9 2202安装部署Zabbix 6.4.20</h1>
<h1>一、系统环境准备</h1>
<ul>
<li>
<p><strong>部署信息</strong></p>
<p><strong>操作系统版本</strong>：Centos7.9_Release 2202</p>
<p><strong>VMware Hostname</strong>：75.142_Centos7_Zabbix6</p>
<blockquote>
<p><strong>ip address</strong>：172.16.75.142<br />
<strong>ssh port</strong>：60022<br />
<strong>账号</strong>：root/admin<br />
<strong>密码</strong>：Zabbix@2024.12.#</p>
</blockquote>
</li>
<li>
<p><strong>环境说明</strong></p>
<blockquote>
<p>mysql版本   8.0.X<br />
gcc版本    大于4.8<br />
php版本    大于7.2.5</p>
</blockquote>
</li>
<li>
<p><strong>准备工作</strong></p>
<blockquote>
<p><strong>#关闭防火墙和安全机制</strong></p>
</blockquote>
<pre><code class="language-bash">systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i "s/^SELINUX=.*$/SELINUX=disabled/" /etc/selinux/config</code></pre>
</li>
<li>
<p><strong>更换阿里云yum源</strong></p>
<pre><code class="language-bash">curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all &amp; yum makecache</code></pre>
</li>
</ul>
<h1>二、安装mysql</h1>
<ul>
<li>
<p><strong>配置Mysql 8.0安装源</strong></p>
<pre><code class="language-bash">rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-6.noarch.rpm</code></pre>
</li>
<li>
<p><strong>安装Mysql 8.0</strong></p>
<blockquote>
<p><strong>不安装mysql-devel ，后面编译zabbix会报错：configure: error: MySQL library not found</strong></p>
</blockquote>
<pre><code class="language-bash">yum -y --enablerepo=mysql80-community install mysql-community-server mysql-devel --nogpgcheck</code></pre>
</li>
<li>
<p><strong>启动数据库服务</strong></p>
<pre><code class="language-bash">systemctl start mysqld
systemctl enable mysqld</code></pre>
</li>
<li>
<p><strong>创建mysql账户</strong></p>
<pre><code class="language-bash">cat /var/log/mysqld.log | grep password
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Jzx@2024#';
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by 'Zbx@2024#';
grant all privileges on zabbix.* to zabbix@localhost;</code></pre>
</li>
<li>
<p><strong>MySQL数据库配置过程：</strong></p>
<pre><code class="language-bash">[root@zabbix6 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.40Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. 
Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; ALTER USER 'root'@'localhost' IDENTIFIED BY 'Jzx@2024#';
Query OK, 0 rows affected (0.35 sec)

mysql&gt; create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected, 2 warnings (0.03 sec)

mysql&gt; create user zabbix@localhost identified by 'Jzx_2024#';
Query OK, 0 rows affected (0.02 sec)

mysql&gt; grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.16 sec)

mysql&gt; quit
Bye</code></pre>
</li>
</ul>
<h1>三、安装centos-release-scl</h1>
<ul>
<li>
<p><strong>执行命令安装</strong></p>
<pre><code class="language-bash">yum install -y centos-release-scl net-snmp-devel libevent-devel</code></pre>
<ul>
<li><strong><em>重要提示</em></strong> <strong><em>：安装完centos-release-scl后，由于SCL源 <a href="http://mirrorlist.centos.org">http://mirrorlist.centos.org</a> 在2024年6月30日已经停止服务，scl源里面默认使用了centos官方的地址，因此我们需要更改scl源的baseUrl，替换为阿里云。</em></strong></li>
</ul>
<pre><code class="language-bash">cd /etc/yum.repos.d/
vim CentOS-SCLo-scl.repo
vim CentOS-SCLo-scl-rh.repo</code></pre>
<p>找到 <strong>​<code>CentOS-SCLo-scl.repo</code>​</strong>​ 和 <strong>​<code>CentOS-SCLo-scl-rh.repo</code>​</strong>​，将<strong>​<code>mirrorlist=</code>​</strong> ​行注释掉，将<strong>​<code>baseurl=</code>​</strong> ​ 行取消注释，域名地址改为阿里云 <a href="https://mirrors.aliyun.com">https://mirrors.aliyun.com</a></p>
<ul>
<li><strong>不安装net-snmp-devel libevent-devel后面编译会报错：</strong></li>
</ul>
<pre><code class="language-bash">configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
configure: error: Unable to use libevent (libevent check failed)q</code></pre>
</li>
</ul>
<h1>四、离线安装gcc</h1>
<ul>
<li>
<p><strong>下载下面的rpm包</strong></p>
<p>​<img src="assets/image-20241205101701-eqd60p8.png" alt="image" />​</p>
</li>
<li>
<p><strong>上传至服务器</strong></p>
<pre><code class="language-bash">[root@zabbix6 gcc-g++-4.8.5-rpm]# ll
总用量 39324
-rw-r--r--. 1 root root  6234536 12月  5 10:14 cpp-4.8.5-28.el7.x86_64.rpm
-rw-r--r--. 1 root root 16967040 12月  5 10:14 gcc-4.8.5-28.el7.x86_64.rpm
-rw-r--r--. 1 root root  7534972 12月  5 10:14 gcc-c++-4.8.5-36.el7.x86_64.rpm
-rw-r--r--. 1 root root  1116252 12月  5 10:14 glibc-devel-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root   694524 12月  5 10:14 glibc-headers-2.17-222.el7.x86_64.rpm
-rw-r--r--. 1 root root  7442492 12月  5 10:14 kernel-headers-3.10.0-862.el7.x86_64.rpm
-rw-r--r--. 1 root root    51732 12月  5 10:14 libmpc-1.0.1-3.el7.x86_64.rpm
-rw-r--r--. 1 root root   208316 12月  5 10:14 mpfr-3.1.1-4.el7.x86_64.rpm</code></pre>
</li>
<li>
<p><strong>安装rpm包</strong></p>
<blockquote>
<p><strong>进入目录，执行</strong>​*<em>​`rpm  -ivh  </em>.rpm --nodeps --force`​<strong>​</strong>命令安装所有rpm包及相关依赖**</p>
</blockquote>
<pre><code class="language-bash">[root@zabbix6 gcc-g++-4.8.5-rpm]# rpm  -ivh  *.rpm --nodeps --force
警告：cpp-4.8.5-28.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
 1:mpfr-3.1.1-4.el7                 ################################# [ 13%]
 2:libmpc-1.0.1-3.el7               ################################# [ 25%]
 3:cpp-4.8.5-28.el7                 ################################# [ 38%]
 4:kernel-headers-3.10.0-862.el7    ################################# [ 50%]
 5:glibc-headers-2.17-222.el7       ################################# [ 63%]
 6:glibc-devel-2.17-222.el7         ################################# [ 75%]
 7:gcc-4.8.5-28.el7                 ################################# [ 88%]
 8:gcc-c++-4.8.5-36.el7             ################################# [100%]</code></pre>
</li>
<li>
<p>​<strong>​<code>gcc -v</code>​</strong>​<strong>检查</strong></p>
<pre><code class="language-bash">[root@zabbix6 gcc-g++-4.8.5-rpm]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标：x86_64-redhat-linux
配置为：../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型：posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)</code></pre>
</li>
</ul>
<h1>五、安装Zabbix6.4.20</h1>
<ul>
<li>
<p><strong>下载zabbix-6.4.20.tar.gz包并上传至服务器</strong></p>
<p>登录官网找到版本下载：<a href="https://cdn.zabbix.com/zabbix/sources/stable/6.4/">https://cdn.zabbix.com/zabbix/sources/stable/6.4/</a><br />
或直接下载：<a href="https://cdn.zabbix.com/zabbix/sources/stable/6.4/zabbix-6.4.20.tar.gz">https://cdn.zabbix.com/zabbix/sources/stable/6.4/zabbix-6.4.20.tar.gz</a></p>
</li>
<li>
<p><strong>上传至服务器</strong></p>
<pre><code class="language-bash">[root@zabbix6 ~]# ll
-rw-r--r--. 1 root root 47050234 12月  5 10:22 zabbix-6.4.20.tar.gz</code></pre>
</li>
<li>
<p><strong>创建目录并解压</strong></p>
<p><strong>mkdir /usr/local/zabbix<br />
tar -zxvf zabbix-6.4.3.tar.gz -C /usr/local/zabbix/</strong></p>
<pre><code class="language-bash">[root@zabbix6 ~]# ll /usr/local/zabbix/
总用量 4
drwxr-xr-x. 13 admin admin 4096 11月 19 22:59 zabbix-6.4.20</code></pre>
</li>
<li>
<p><strong>创建Zabbix用户及用户组</strong></p>
<pre><code class="language-bash">groupadd zabbix
useradd -g zabbix -M -s /sbin/nologin zabbix</code></pre>
</li>
<li>
<p><strong>编译安装Zabbix6.4</strong></p>
<pre><code class="language-bash">cd /usr/local/zabbix/zabbix-6.4.3/
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-net-snmp --with-mysql</code></pre>
</li>
<li>
<p><strong>编译配置成功</strong></p>
<pre><code class="language-julia">***********************************************************
*                                      Now run 'make install'                                           *
*                                                                                                                         *
*                                   Thank you for using Zabbix!                                     *
*                                    &lt;http://www.zabbix.com&gt;                                       *
***********************************************************</code></pre>
</li>
<li>
<p><strong>执行</strong> <strong>​<code>make install</code>​</strong>​<strong>进行编译</strong></p>
<pre><code class="language-bash">make install</code></pre>
<p>无报错完成即可</p>
</li>
</ul>
<h1>六、安装PHP</h1>
<ul>
<li>
<p><strong>安装remi库</strong></p>
<blockquote>
<p>由于CentOS7自带PHP版本为5.6，所以需要安装额外的库，也是remi的库：</p>
</blockquote>
<pre><code class="language-julia">yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils epel-release
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable   remi-php74
yum -y install php php-bcmath php-gd php-xml php-mbstring php-mysqlnd php-ldap
yum -y install libxml2 libxml2-devel</code></pre>
<blockquote>
<p>检查版本</p>
</blockquote>
<pre><code class="language-bash">[root@localhost ~]# php -v
PHP 7.4.33 (cli) (built: Jun  6 2023 16:33:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies</code></pre>
<blockquote>
<p>vim /etc/php.ini ，修改以下值</p>
</blockquote>
<pre><code class="language-python">max_execution_time = 300
post_max_size = 16M
max_input_time = 300</code></pre>
</li>
</ul>
<h1>七、配置httpd，导入zabbix数据，启动zabbix服务</h1>
<ul>
<li>
<p><strong>配置httpd</strong></p>
<blockquote>
<p>移动前端文件至web服务的根目录并授权</p>
</blockquote>
<pre><code class="language-yaml">cp -r /usr/local/zabbix/zabbix-6.4.3/ui/* /var/www/html/
chown apache:apache /var/www/html -R</code></pre>
</li>
<li>
<p><strong>导入数据库架构及数据</strong></p>
<blockquote>
<p>第一行需要使用root账户，否则会报错：</p>
</blockquote>
<p>ERROR 1419 (HY000) at line 2255: You do not have the SUPER privilege and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)</p>
<pre><code class="language-bash">mysql -uroot -pJzx_2024# zabbix &lt; /usr/local/zabbix/zabbix-6.4.20/database/mysql/schema.sql
mysql -uzabbix -pZabbix@123 zabbix &lt; /usr/local/zabbix/zabbix-6.4.20/database/mysql/images.sql
mysql -uzabbix -pZabbix@123 zabbix &lt; /usr/local/zabbix/zabbix-6.4.20/database/mysql/data.sql</code></pre>
</li>
<li>
<p><strong>修改配置zabbixserver文件数据库密码</strong></p>
<pre><code class="language-bash">vim /usr/local/zabbix/etc/zabbix_server.conf
DBPassword=Jzx_2024#</code></pre>
</li>
<li>
<p><strong>开启httpd，zabbix_server，zabbix_agent</strong></p>
<pre><code class="language-bash">service httpd start
systemctl enable httpd.service
cd /usr/local/zabbix/sbin/
./zabbix_server
./zabbix_agent</code></pre>
</li>
</ul>
<h1>八、访问zabbix web页面</h1>
<ul>
<li>
<p>登录</p>
<p><a href="http://ip地址">http://ip地址</a></p>
</li>
</ul>
<p>​<img src="assets/image-20241205185538-e0hmke9.png" alt="image" />​</p>
<p>​<img src="assets/image-20241205185545-rcxsy2c.png" alt="image" />​</p>
<ul>
<li>
<p><strong>填写用户名/密码</strong></p>
<blockquote>
<p>zabbix/Jzx_2024#</p>
</blockquote>
</li>
</ul>
<p>​<img src="assets/image-20241205185552-2hljvct.png" alt="image" />​</p>
<p>​<img src="assets/image-20241205185644-5kka79g.png" alt="image" />​</p>
<p>​<img src="assets/image-20241205185651-is4my4i.png" alt="image" />​</p>
<p>默认用户名密码：Admin / zabbix</p>
<p>​<img src="assets/image-20241205185705-4jyy650.png" alt="image" />​</p>
<p>​<img src="assets/image-20241205185711-ep65yeq.png" alt="image" />​</p>
<ul>
<li>
<p><strong>显示中文乱码解决方法</strong></p>
<blockquote>
<p>在zabbix-server服务器上安装如下文件符集</p>
</blockquote>
<pre><code class="language-lua">yum install -y wqy-microhei-fonts</code></pre>
<blockquote>
<p>然后替换zabbix上默认的字符集</p>
</blockquote>
<pre><code class="language-bash">cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /var/www/html/assets/fonts/DejaVuSans.ttf</code></pre>
</li>
<li>
<p><strong>重启zabbix-server</strong></p>
</li>
</ul>
<p>​<img src="assets/image-20241205185932-l9pxewa.png" alt="image" />​</p>
<h1>其他服务器安装zabbix_agent</h1>
<ul>
<li>安装zabbix_agent，使用清华镜像源</li>
</ul>
<pre><code class="language-bash">yum install -y https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/6.4/rhel/7/x86_64/zabbix-agent-6.4.3-release1.el7.x86_64.rpm</code></pre>
<ul>
<li>编辑配置文件，修改以下参数</li>
</ul>
<pre><code class="language-bash">vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.2.5             (server端主机ip)
ServerActive=192.168.2.5       (server端主机ip)
Hostname=192.168.2.4           (此主机名与web添加主机名一致)
UnsafeUserParameters=1         (运行自定义参数)</code></pre>
<ul>
<li>启动&amp;&amp;开机自启动</li>
</ul>
<pre><code class="language-bash">systemctl start zabbix-agent
systemctl enable zabbix-agent</code></pre>
<ul>
<li>去zabbix_server添加主机 !</li>
</ul>]]></description>
    <pubDate>Fri, 10 Jan 2025 11:22:22 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=15</guid>
</item>
<item>
    <title>iBMC命令行参数</title>
    <link>https://www.oame2024.cn/?post=14</link>
    <description><![CDATA[<h1>iBMC命令行参数</h1>
<p>ssh登录iBMC，输入账号密码（与WebUI相同）</p>
<p>‍</p>
<pre><code class="language-bash">BMC:/-&gt;help
Commands:
help      :       Used to get context sensitive help.
exit      :       Used to terminate the CLP session.
ipmcget   :       Used to get BMC runtime status.                             # 用于获取BMC运行时状态。
ipmcset   :       Used to set BMC runtime status or send control command.     # 用于设置BMC运行状态或发送控制命令。
notimeout :       Used to set no timeout limit to login shell.                # 用于为登录shell设置无超时限制。
maint_debug_cli : Used to maintance in debug mode.                            # 用于debug模式下进行维护。
ping      :       Used to test IPv4 network status.
ping6     :       Used to test IPv6 network status.
ifconfig  :       Used to check network device information.                   # 用于检查网络设备信息。
free      :       Used to check memory status.                                # 用于检查内存状态。
top       :       Used to check system resource used information. None parameter is allowed# 用于检查系统资源使用信息。不允许使用任何参数
df        :       Used to check disk used information.                        # 用于检查磁盘使用信息。
route     :       Used to check route information. None parameter is allowed  # 用于检查路由信息。不允许使用任何参数
netstat   :       Used to check network port status.                          # 用于检查网络端口状态。</code></pre>
<h2>ipmcget</h2>
<pre><code class="language-bash">BMC:/-&gt;ipmcget
Usage: ipmcget [-t target] -d dataitem [-v value]
    -t &lt;target&gt;
       fru0                          Get the information of the fru0     # 获取fru0的信息              
       sensor                        Print detailed sensor information   # 打印详细的传感器信息               
       smbios                        Get the information of smbios       # 获取SMBIOS的信息              
       trap                          Get SNMP trap status                # 获取SNMP陷阱状态              
       service                       Get service information                         
       maintenance                   Get maintenance information                     
       syslog                        Get syslog status                               
       user                          Get the information of user                     
       securitybanner                Get login security banner information           
       vnc                           Get VNC information                             
       storage                       Get storage device information                  
       config                        Get configuration information                   
       vmm                           Get Virtual Media information                   
       certificate                   Get SSL certificate information                 
       sol                           Get SOL information                             
       securityenhance               Get security enhance information                
       usbmgmt                       Get usb mgmt service information                

    -d &lt;dataitem&gt;
       faninfo                       Get fan mode and the percentage of the fan speed  
       port80                        Get the diagnose code of port 80                
       diaginfo                      Get diagnostic info of management subsystem     
       systemcom                     Get system com data                             
       blackbox                      Get black box data                              
       bootdevice                    Get boot device                                 
       shutdowntimeout               Get graceful shutdown timeout state and value   
       powerstate                    Get power state                                 
       health                        Get health status                               
       healthevents                  Get health events                               
       sel                           Print System Event Log (SEL)                    
       operatelog                    Print operation log                             
       version                       Get BMC version                                 
       serialnumber                  Get system serial number                        
       userlist                      List all user info                              
       fruinfo                       Get fru information                             
       time                          Get system time                                 
       macaddr                       Get mac address                                 
       serialdir                     Get currently connected serial direction        
       rollbackstatus                Get rollback status                             
       passwordcomplexity            Get password complexity check enable status     
       ledinfo                       Get led information                             
       ipinfo                        Get ip information                              
       ethport                       Get usable eth port                             
       psuinfo                       Get PSU component information                   
       autodiscovery                 Get autodiscovery configuration                 
       poweronpermit                 Get poweronpermit configuration                 
       minimumpasswordage            Get minimum password age configuration          
       ntpinfo                       Get NTP information                             
       notimeoutstate                Get CLI session notimeout state                 
       lldpinfo                      Get LLDP information            </code></pre>
<h2>ipmcset</h2>
<pre><code class="language-bash">BMC:/-&gt;ipmcset
Usage: ipmcset [-t 目标] -d 数据项 [-v value值]
For excmples: ipm -t sel -d 
    -t &lt;target&gt;
       fru0                          Operate with fru0                               
       trap                          Operate SNMP trap                           # 操作SNMP陷阱      
       service                       Operate with service                            
       user                          Operate with user                               
       maintenance                   Operate with maintenance                    # 维修状况下操作      
       sensor                        Operate with sensor                         # 传感器操作      
       securitybanner                Operate login security banner information   # 登录安全banner信息操作      
       syslog                        Operate syslog                              # 操作系统日志      
       ntp                           Operate ntp                                 # 操作网络时间协议（NTP）      
       vnc                           Operate vnc                                     
       storage                       Configure storage device                    # 配置存储设备      
       config                        Operate configuration                       # 操作配置      
       vmm                           Operate virtual media                       # 操作虚拟媒体      
       certificate                   Operate certificate                         # 操作证书      
       sol                           Operate SOL                                 # 操作SOL     
       securityenhance               Operate security enhance                    # 操作安全增强      
       precisealarm                  Operate with precise alarm                  # 精确报警操作      
       usbmgmt                       Operate USB mgmt service                        
       lldp                          Operate lldp                                    

    -d &lt;dataitem&gt;
       fanmode                       Set fan mode,you can choose manual or auto  # 设置风扇模式，你可以选择手动或自动。      
       fanlevel                      Set fanlevel                                # 设置风扇等级      
       reset                         Reboot BMC system                           # 重启BMC系统      
       identify                      Operate identify led                        # 操作识别LED      
       upgrade                       Upgrade component                           # 升级组件      
       clearcmos                     Clear CMOS                                  # 清除CMOS      
       bootdevice                    Set boot device                                 
       shutdowntimeout               Set graceful shutdown timeout state and value  # 设置最优的关闭超时的状态和数值   
       frucontrol                    Fru control                                 # Fru控制      
       powerstate                    Set power state                                 
       sel                           Clear SEL                                       
       adduser                       Add user                                        
       password                      Modify user password                            
       deluser                       Delete user                                     
       privilege                     Set user privilege                              
       serialdir                     Set serial direction                        # 设置串行方向     
       printscreen                   Print current screen to BMC                 # 将当前屏幕打印到BMC      
       rollback                      Perform a manual rollback                       
       timezone                      Set time zone                                   
       passwordcomplexity            Set password complexity check enable state      
       ipaddr                        Set ip address                                  
       backupipaddr                  Set backup ip address                           
       ipmode                        Set ip mode                                     
       gateway                       Set gateway                                     
       ipaddr6                       Set ipv6 address                                
       ipmode6                       Set ipv6 mode                                   
       gateway6                      Set ipv6 gateway                                
       netmode                       Set net mode                                    
       activeport                    Set EthGroup active port                        
       vlan                          Set sideband vlan                               
       restore                       Restore factory setting                         
       notimeout                     Set no timeout state                            
       emergencyuser                 Set emergency user                              
       autodiscovery                 Set autodiscovery configuration                 
       poweronpermit                 Set poweronpermit configuration                 
       minimumpasswordage            Set minimum password age configuration          
       crl                           Upload CRL file                                 
       psuworkmode                   Set PSU work mode                               
       fpgagoldenfwrestore           FPGA golden firmware restore   </code></pre>
<p>‍</p>]]></description>
    <pubDate>Fri, 10 Jan 2025 11:09:27 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=14</guid>
</item>
<item>
    <title>Netapp主控制器作业前期健康检查</title>
    <link>https://www.oame2024.cn/?post=13</link>
    <description><![CDATA[<h1>主控制器作业前期健康检查</h1>
<ol>
<li>Verify that storage failover is enabled and possible for each HA pair:</li>
</ol>
<blockquote>
<p>验证每个高可用性对是否已启用并且可能执行存储切换：</p>
</blockquote>
<p><strong>storage failover show</strong></p>
<pre><code class="language-applescript">DM3KH_B::*&gt; storage failover show
                              Takeover        
Node           Partner        Possible State Description  
-------------- -------------- -------- -------------------------------------
DM3KH_B-01     DM3KH_B-02     false    In takeover, Auto giveback will be
                                       initiated in 18 seconds
DM3KH_B-02     DM3KH_B-01     -        Waiting for giveback
2 entries were displayed.
</code></pre>
<ol start="2">
<li>If the cluster consists of only two nodes (a single HA pair), verify that cluster HA is configured:</li>
</ol>
<blockquote>
<p>如果群集仅由两个节点（单个高可用性对）组成，请验证群集高可用性是否已配置：</p>
</blockquote>
<p><strong>cluster ha show</strong></p>
<ol start="3">
<li>Verify that the nodes in the cluster are online and are eligible to participate in the cluster:</li>
</ol>
<blockquote>
<p>验证集群中的节点是否在线并且有资格参与集群：</p>
</blockquote>
<p><strong>cluster show</strong></p>
<ol start="4">
<li>Display the failover policy for each data port:</li>
</ol>
<blockquote>
<p>显示每个数据端口的故障转移策略：</p>
</blockquote>
<p><strong>network interface show -role data –failover</strong></p>
<ol start="5">
<li>Verify that each node has the same date and time:</li>
</ol>
<blockquote>
<p>验证每个节点的日期和时间是否相同：</p>
</blockquote>
<p>cluster date show</p>
<ol start="6">
<li>Review the list of any running or queued aggregate, volume, or Snapshot jobs:</li>
</ol>
<blockquote>
<p>查看任何正在运行或排队的聚合、卷或快照作业的列表：</p>
</blockquote>
<p>job show</p>
<ol start="7">
<li>Delete any running or queued aggregate, volume, or Snapshot copy jobs:</li>
</ol>
<blockquote>
<p>删除任何正在运行或排队的聚合、卷或快照复制作业：</p>
</blockquote>
<p>job delete -id job_id</p>
<ol start="8">
<li>Verify that all LIFs are in their home ports:</li>
</ol>
<blockquote>
<p>验证所有LIF（逻辑接口）是否在其主端口中：</p>
</blockquote>
<p><strong>network interface show</strong></p>
<ol start="9">
<li>View and record any LIFs that have automatic LIF rebalancing enabled:</li>
</ol>
<blockquote>
<p>查看并记录所有已启用自动LIF重新平衡的LIF：</p>
</blockquote>
<p><strong>network interface show -allow-lb-migrate true</strong></p>
<ol start="10">
<li>Disable automatic LIF rebalancing for each LIF that you identified:</li>
</ol>
<blockquote>
<p>为您标识的每个LIF禁用自动LIF再平衡：</p>
</blockquote>
<p>*<em>network interface modify </em> -allow-lb-migrate false**</p>]]></description>
    <pubDate>Fri, 10 Jan 2025 11:04:35 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=13</guid>
</item>
<item>
    <title>Netapp硬件检查命令</title>
    <link>https://www.oame2024.cn/?post=12</link>
    <description><![CDATA[<h1>状态检查类</h1>
<ul>
<li>
<h4>硬件检查 environment status all</h4>
</li>
</ul>
<pre><code class="language-applescript">DM3KH_B::*&gt; environment status all
  "environment status" is not supported: use the "system node run -node &lt;nodename&gt; -command environment status" command.

DM3KH_B::*&gt; system node run -node DM3KH_B-02 -command environment status
Sensor Name              State          Current    Critical     Warning     Warning    Critical
                                        Reading       Low         Low         High       High
-------------------------------------------------------------------------------------------------
PSU2 FRU                                  GOOD
PSU1 FRU                                  GOOD
Attention From SP                       DEASSERT
SP Status                               IPMI_HB_OK
mSATA Status                                OK
mSATA Pres                              PRESENT
init                     invalid            --
    Environment for channel 0a
    Number of shelves monitored: 1  enabled: yes
    Environmental failure on shelves on this channel? no

    Channel: 0a
    Shelf: 0
    SES device path: local access: 0a.00.99
    Module type: IOM12E; monitoring is active  
    Shelf status: normal condition
    SES Configuration, shelf 0:
     logical identifier=0x500a0980084fcad8
     vendor identification=NETAPP  
     product identification=DS212-12
     product revision level=0201
    Vendor-specific information:
     Product Serial Number: J3026EBA
    Status reads attempted: 208216; failed: 0
    Control writes attempted: 0; failed: 0
    Shelf bays with disk devices installed:
      11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
      with error: none
    Power Supply installed element list: 1, 2; with error: none
    Power Supply information by element:
      [1] Serial number: PSQ094194801315  Part number: 114-00148+F0
          Type: 7D
          Firmware version: 0111  Swaps: 0
      [2] Serial number: PSQ094194802841  Part number: 114-00148+F0
          Type: 7D
          Firmware version: 0111  Swaps: 0
    Voltage Sensor installed element list: 1, 2, 3, 4; with error: none
    Shelf voltages by element:
      [1] 5.01 Volts  Normal voltage range
      [2] 12.03 Volts  Normal voltage range
      [3] 5.00 Volts  Normal voltage range
      [4] 12.02 Volts  Normal voltage range
    Current Sensor installed element list: 1, 2, 3, 4; with error: none
    Shelf currents by element:
      [1] 3040 mA  Normal current range
      [2] 9640 mA  Normal current range
      [3] 2460 mA  Normal current range
      [4] 8820 mA  Normal current range
    Cooling Unit installed element list: 1, 2, 3, 4; with error: none
    Cooling Units by element:
      [1] 3070 RPM
      [2] 2940 RPM
      [3] 3000 RPM
      [4] 3000 RPM
    Temperature Sensor installed element list: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15; with error: none
    Shelf temperatures by element:
      [1] 23 C (73 F) (ambient)  Normal temperature range
      [2] 30 C (86 F)  Normal temperature range
      [3] 30 C (86 F)  Normal temperature range
      [4] 30 C (86 F)  Normal temperature range
      [5] 30 C (86 F)  Normal temperature range
      [6] 28 C (82 F)  Normal temperature range
      [7] 31 C (87 F)  Normal temperature range
      [8] 30 C (86 F)  Normal temperature range
      [9] 31 C (87 F)  Normal temperature range
      [10] 39 C (102 F)  Normal temperature range
      [11] 56 C (132 F)  Normal temperature range
      [12] 32 C (89 F)  Normal temperature range
      [13] 41 C (105 F)  Normal temperature range
      [14] 57 C (134 F)  Normal temperature range
      [15] 34 C (93 F)  Normal temperature range
    Temperature thresholds by element:
      [1] High critical: 50 C (122 F); high warning: 47 C (116 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [2] High critical: 60 C (140 F); high warning: 55 C (131 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [3] High critical: 60 C (140 F); high warning: 55 C (131 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [4] High critical: 60 C (140 F); high warning: 55 C (131 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [5] High critical: 60 C (140 F); high warning: 55 C (131 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [6] High critical: 62 C (143 F); high warning: 57 C (134 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [7] High critical: 100 C (212 F); high warning: 90 C (194 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [8] High critical: 62 C (143 F); high warning: 57 C (134 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [9] High critical: 100 C (212 F); high warning: 90 C (194 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [10] High critical: 90 C (194 F); high warning: 80 C (176 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [11] High critical: 105 C (221 F); high warning: 100 C (212 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [12] High critical: 75 C (167 F); high warning: 60 C (140 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [13] High critical: 90 C (194 F); high warning: 80 C (176 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [14] High critical: 105 C (221 F); high warning: 100 C (212 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
      [15] High critical: 75 C (167 F); high warning: 60 C (140 F)
          Low critical:  0 C (32 F); low warning:  5 C (41 F)
    ES Electronics installed element list: 1, 2; with error: none
    ES Electronics reporting element: 1
    ES Electronics information by element:
      [1] Serial number: 041946028837  Part number: 111-04088+D1
          CPLD version: 24  Swaps: 0
      [2] Serial number: 041946028659  Part number: 111-04088+D1
          CPLD version: 24  Swaps: 0
    Enclosure element list: 1; with error: none;
    Enclosure information:
      [1] WWN: 500a0980084fcad8  Shelf ID: 00
          Serial number: J3026EBA  Part number: 7Y42CTO1WW
          Midplane serial number: 032006003316  Midplane part number: 110-00513+A0
    SAS connector attached element list: 1, 2, 3; with error: none
    SAS cable information by element:
      [1] Internal connector
      [2] Vendor: LUXSHARE-ICT
          Type: MINI-SAS HD passive copper 0.5-1.0m  ID: 00  Swaps: 0
          Serial number: 19315  Part number: L01HE017-SD-R+A
      [3] Internal connector
      [4] Vendor: &lt;N/A&gt; (disconnected)
          Type: &lt;N/A&gt; &lt;N/A&gt; &lt;N/A&gt;  ID: &lt;N/A&gt;  Swaps: 0
          Serial number: &lt;N/A&gt;  Part number: &lt;N/A&gt;
    ACP installed element list: 1, 2; with error: none
    ACP information by element:
      [1] MAC address: D0:39:EA:13:74:56
      [2] MAC address: D0:39:EA:13:65:E8
    External Ethernet Connector installed element list: 1, 2; with error: none
    External Ethernet Connector information by element:
      [1] MAC address: D0:39:EA:13:74:58  Attached MAC address: &lt;N/A&gt;
          Attached port: &lt;N/A&gt;  Attached chassis: &lt;N/A&gt;
          Attached manufacturer: &lt;N/A&gt;
          Cable serial number: &lt;N/A&gt;  Cable vendor name: &lt;N/A&gt;
          Cable id: &lt;N/A&gt;  Cable end: &lt;N/A&gt;
          Cable technology: &lt;N/A&gt;  Cable length: &lt;N/A&gt;
      [2] MAC address: D0:39:EA:13:65:EA  Attached MAC address: &lt;N/A&gt;
          Attached port: &lt;N/A&gt;  Attached chassis: &lt;N/A&gt;
          Attached manufacturer: &lt;N/A&gt;
          Cable serial number: &lt;N/A&gt;  Cable vendor name: &lt;N/A&gt;
          Cable id: &lt;N/A&gt;  Cable end: &lt;N/A&gt;
          Cable technology: &lt;N/A&gt;  Cable length: &lt;N/A&gt;
    Processor Complex attached element list: 1, 2 with error: none
    SAS Expander Module installed element list: 1, 2; with error: none
    SAS Expander master module: 1

    Shelf mapping (shelf-assigned addresses) for channel 0a:
      Shelf   0: XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX  11  10   9   8   7   6   5   4   3   2   1   0
</code></pre>
<p>‍</p>]]></description>
    <pubDate>Fri, 10 Jan 2025 10:58:27 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=12</guid>
</item>
<item>
    <title>Netapp系统节点命令 - system node</title>
    <link>https://www.oame2024.cn/?post=11</link>
    <description><![CDATA[<h1>系统节点命令 - system node</h1>
<p>‍</p>
<h4>一、停止系统节点</h4>
<p>cluster1 :: &gt; system node halt</p>
<pre><code>    # 该命令将停止一个节点上的所有活动。您可以提供关闭的原因，这将存储在审计日志中。您还可以阻止合作伙伴节点在关闭期间执行存储接管。</code></pre>
<p>参数</p>
<p>-node {<nodename>|local} - 节点</p>
<pre><code>    # 使用此强制性参数可以指定要关闭的节点。本地值指定当前节点。</code></pre>
<p>-reason <text>] - 关机原因</p>
<pre><code>    # 使用此参数可以输入简要说明，以指示重新启动的原因，这将存储在审核日志中。提供这些信息有助于技术支持人员进行故障排除。</code></pre>
<p>[-inhibit-takeover | -f [true]] - 禁止合作伙伴接管存储</p>
<pre><code>    # 此参数可选地强制关闭并防止存储故障转移。即使抑制接管设置为true，lif也会在关闭前迁移。为了防止LIF迁移，关机前的跳过自由迁移应该设置为true。
    # 在双节点MetroCluster配置中，此参数可防止自动进行计划外切换。
    # 注意： 如果-inhibit-takeover设置为true，则忽略"storag efailover show"在932页的"-fields onreboot"命令”默认行为。
    # 如果不使用此参数输入此命令，则其有效值为false，允许存储接管。如果输入此参数没有值，则它将自动设置为true，并在重新启动期间禁用存储接管。</code></pre>
<p>[-dump | -d [true]] - 创建核心转储</p>
<pre><code>    # 如果此参数设置为true，则在停止节点时强制内核转储。</code></pre>
<p>[-skip-lif-migration-before-shutdown [true]] - 在关闭之前跳过从节点迁移&quot;lif&quot;</p>
<pre><code>    # 如果指定了此参数，则将跳过关闭前的LIF迁移。但是，如果此节点上的lif配置为故障转移，这些lif仍可能在关闭后进行故障转移。默认设置是在关闭前迁移   
    # lif。在默认情况下，命令尝试在关闭之前同步迁移数据和集群管理lif远离节点。如果迁移失败或超时，关闭将被中止。</code></pre>
<p>[-ignore-quorum-warnings [true]] - 在关闭前跳过仲裁检查</p>
<pre><code>    # 如果指定了此参数，则将在关闭之前跳过仲裁检查。即使由于仲裁问题可能导致数据中断，该操作仍将继续。</code></pre>
<p>[-ignore-strict-sync-warnings [true]] - 在重新启动前跳过镜像快照同步的严格同步检查</p>
<pre><code>    # 如果指定了此参数，将跳过与严格同步镜像策略的快镜同步关系的卷的检查。即使由于无法完全同步数据而可能导致数据中断，该操作也将继续进行。</code></pre>
<pre><code>
**举例：**

```bash
下面的示例将关闭名为集群1的节点以进行硬件维护

cluster1::&gt; system halt -node cluster1 -reason 'hardware maintenance‘</code></pre>
<h4>二、系统节点重新启动</h4>
<pre><code class="language-bash">cluster1 :: &gt; system node reboot

        # "system node reboot"命令重新启动一个节点。您可以提供重新启动的原因，它存储在审计日志中。您还可以防止合作伙伴节点在重新启动期间执行存储接管，
        # 并指示重新启动的节点创建一个核心转储。

-node {&lt;nodename&gt;|local} - 节点

        # 指定要重新启动的节点。“local”值指定当前节点。

[-inhibit-takeover | -f [true]] - 禁止合作伙伴接管存储

        # 如果设置为true，此参数指定当节点重新启动时，不允许节点的故障转移伙伴接管该节点。即使在将抑制接管（-inhibit-takeover）设置为true时，逻辑接口
        # （LIF）也会在重新启动之前迁移。要防止LIF迁移，应将重新启动前跳过LIF迁移（-skip-lif-migration-prior-to-reboot）设置为true。在双节点
        # MetroCluster配置中，此参数可防止自动意外切换。如果您输入此命令时未使用此参数，其有效值为假，并且允许存储接管。如果您输入此参数但未提供值，则会
        # 自动将其设置为真，并且在重新启动期间禁用存储接管。

[-reason &lt;text&gt;] - 重启原因

        # 使用此参数输入简短的备注以说明重启的原因，该备注将被存储在审计日志中。提供此信息有助于支持人员进行故障排除工作。

[-dump | -d [true]] - 创建核心转储

        # 如果您希望节点在重新启动之前创建核心转储，请使用此参数指定true值。如果输入此命令时未使用此参数，则其有效值为false，节点不会创建核心转储。如果
        # 输入此参数时未提供值，则会自动设置为真，节点将创建核心转储。

[-skip-lif-migration-before-reboot [true]] - 重启前跳过将LIF从节点迁移的操作

        # 如果指定了此参数，将跳过重启前的LIF迁移。但是，如果此节点上的LIF配置了故障切换，这些LIF在重启后仍可能发生故障切换。默认值是在重启前迁移LIF。
        # 在默认情况下，命令尝试在重启之前将数据和群集管理LIF同步迁出节点。如果迁移失败或超时，将中止重启。

[-ignore-quorum-warnings [true]] - 重启前跳过仲裁检查

        # 如果指定了此参数，重启前将跳过仲裁检查。即使由于仲裁问题可能导致数据中断，操作仍将继续。

[-ignore-strict-sync-warnings [true]] - 重启前跳过SnapMirror同步严格同步检查

        # 如果指定了此参数，则将跳过对与类型为strict-sync-mirror的策略具有SnapMirror同步关系的卷的检查。即使由于无法完全同步数据可能导致数据中断，
        # 操作仍将继续。</code></pre>
<h4>三、系统节点运行</h4>
<pre><code class="language-bash">cluster1 :: &gt; system node run

        # 在节点Shell中运行交互式或非交互式命令
        # 在集群的特定节点上从节点Shell CLI运行某些命令。您可以从立即返回的集群Shell中运行单个节点Shell命令，也可以启动交互式节点Shell会话，从中可以
        # 运行多个节点Shell命令。

        # 节点Shell命令对于根卷管理和系统故障排除非常有用。通过节点Shell可用的命令的作用域是集群中的一个节点。也就是说，它们只影响由"-node"参数的值指定
        # 的节点，而不对集群中的其他节点进行操作。要查看可用的节点Shell命令的列表，请键入“？”在交互式节点Shell提示下。有关可用命令的含义和用法的更多信
        # 息，请使用节点盘中的“man"命令。

        # 每次只能在集群中的其中一个节点上运行一个交互式节点Shell会话。在一个节点上，一次最多可以运行24个并发的非交互式会话。

        # 交互式运行节点命令时，退出节点命令并使用退出命令返回到集群Shell。如果节点Shell不响应命令，请终止节点Shell进程，并通过按Ctrl-D返回到集群  
        # Shell。

        # GUI界面无法提供该命令。

        # 注意：另一种方式调用“system node run”命令是通过将运行作为单个单词键入来实现的。</code></pre>
<p><strong>举例</strong></p>
<pre><code class="language-bash">以下示例在名为node1的节点上运行节点Shell命令"sysconfig -V"：

cluster1::&gt; system node run -node node1 -command sysconfig -V
volume node1_aggr0 (1 RAID group):
        group 0: 3 disks

以下示例在名为node2的节点上启动一个节点Shell会话，然后运行NodeShell"sysconfig -V"命令。运行"sysconfig -V"命令后，系统将保持在节点shell中。

cluster1::&gt; run -node node2
Type 'exit' or 'Ctrl-D' to return to the CLI
node2&gt; sysconfig -V
volume node2_aggr0 (1 RAID group):
        group 0: 3 disks
node2&gt;

以下示例在名为node1的节点上启动一个节点shell会话，然后运行两个节点shell命令，先运行aggr status，再运行vol status。使用单引号和分号在执行单个run命令时运行多个节点shell命令。

cluster1::&gt; run -node node1 -command "aggr status; vol status"
         Aggr State          Status                Options
        aggr0 online        raid_dp, aggr        root
                             parity uninit'd!
                             32-bit
        aggr1 online        raid_dp, aggr
                             parity uninit'd!
                             32-bit
        Volume State         Status                Options
        vol0 online         raid_dp, flex        root, nvfail=on
                             parity uninit'd!
      root_vs0 online       raid_dp, flex        create_ucode=on,
                             cluster              convert_ucode=on,
                             parity uninit'd!    maxdirsize=102400</code></pre>
<ul>
<li>‍</li>
</ul>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>
<p>‍</p>]]></description>
    <pubDate>Fri, 10 Jan 2025 10:57:42 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=11</guid>
</item>
<item>
    <title>通过SCUU升级SCOS</title>
    <link>https://www.oame2024.cn/?post=8</link>
    <description><![CDATA[<h1>通过SCUU升级SCOS</h1>
<p>通过SCUU升级SCOS</p>
<p>下载scos-official-R0x.x.x.x.zip 及 SCUU工具，适用于SCOS 6.6.x及以上的版本，升级不影响业务运行。</p>
<p>升级固件之前建议发送SupportAssist日志，做健康检查，升级操作建议在业务空闲时进行。</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/76e31728019870.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/76e31728019870.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/cb0d1728019885.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/cb0d1728019885.png" alt="" /></a></p>
<p>解压SCOS，在SCUU中加载。</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/4e651728019924.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/4e651728019924.png" alt="" /></a></p>
<p>EM关闭SupportAssist，启用 Update Utility Host or IP Address，端口 9005</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/1d3e1728019932.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/1d3e1728019932.png" alt="" /></a></p>
<p>关闭Windows防火墙</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/2cdc1728019941.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/2cdc1728019941.png" alt="" /></a></p>
<p>SCUU点击Start</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/71711728019948.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/71711728019948.png" alt="" /></a></p>
<p>EM中选择Summary - Actions - System - Check for Update</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/a97e1728019961.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/a97e1728019961.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/78d71728019968.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/78d71728019968.png" alt="" /></a></p>
<p>估计时间5分钟</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/f59f1728019976.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/f59f1728019976.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/d13b1728019984.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/d13b1728019984.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/7b1b1728019992.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/7b1b1728019992.png" alt="" /></a><br />
开始下载</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/1d121728020015.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/1d121728020015.png" alt="" /></a></p>
<p>开始安装</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/f1871728020055.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/f1871728020055.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/fba51728020064.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/fba51728020064.png" alt="" /></a></p>
<p>重启SC服务</p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/00d21728020078.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/00d21728020078.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/a6671728020084.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/a6671728020084.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/5ba21728020098.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/5ba21728020098.png" alt="" /></a></p>
<p><a href="https://www.oame2024.cn/content/uploadfile/202410/be391728020105.png"><img src="https://www.oame2024.cn/content/uploadfile/202410/be391728020105.png" alt="" /></a></p>
<p>升级完成。</p>]]></description>
    <pubDate>Fri, 04 Oct 2024 13:30:00 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=8</guid>
</item>
<item>
    <title>Nutanix AHV平台集群环境下单台主机停机维护操作手册</title>
    <link>https://www.oame2024.cn/?post=7</link>
    <description><![CDATA[<h1>Nutanix AHV平台集群环境下单台主机停机维护操作手册</h1>
<p><strong>Nutanix AHV平台集群环境下单台主机停机维护操作手册</strong></p>
<p><strong>EAS专业服务处</strong></p>
<p><strong>目  录</strong></p>
<p><a href="#_Toc484462116">1.步骤概要</a></p>
<p><a href="#_Toc484462117">2.操作步骤</a></p>
<p><a href="#_Toc484462118">2.1停机步骤</a></p>
<p><a href="#_Toc484462119">2.2开机步骤：</a></p>
<h1>1. <strong>步骤概要</strong></h1>
<p>在Nutanix的AHV集群环境下，如果需要对于单台主机进行计划停机维护，如添加内存，更换故障硬件等等，其维护步骤跟VMware环境下的步骤基本类似，主要包含：</p>
<p><strong>停机：</strong></p>
<p>l 迁移虚拟机</p>
<p>l 主机进入维护模式</p>
<p>l 关闭CVM</p>
<p>l 关闭主机</p>
<p><strong>开机：</strong></p>
<p>l 主机开机</p>
<p>l CVM开机</p>
<p>l 主机退出维护模式</p>
<p>l 检查集群状态</p>
<p>l 数据同步</p>
<p>l 虚拟机回迁</p>
<h1>2. <strong>操作步骤</strong></h1>
<h2>2.1 <strong>停机步骤</strong></h2>
<ol>
<li>迁移虚拟机；</li>
</ol>
<p>迁移虚拟机的方法可以分为2种，命令行模式或者图形界面模式：</p>
<p><strong>图形界面模式</strong>：</p>
<p>如果虚拟机数量不多，可以采用图形界面模式，具体步骤为：登录Prism管理页面—VM—Table—按照主机进行排列虚拟机—选择需要迁移的虚拟机--Migrate—选择需要迁移到的目标主机。</p>
<p><strong>命令行模式：</strong></p>
<p>SSH到需要维护的主机的CVM虚拟机；</p>
<p>进入acli模式</p>
<p>nutanix@NTNX-J32X62B-A-CVM:15.2.21.244:\~\$ acli</p>
<p>查看各主机的UUID</p>
<p>\&lt;acropolis> host.list</p>
<p>Hypervisor address  Host UUID                             Schedulable</p>
<p>15.2.21.2           7b52e2bc-f558-4253-a00e-ba4f05cde70e  True</p>
<p>15.2.21.241         838eb59b-d48e-4f58-8029-c7dba2307f6d  False</p>
<p>15.2.21.242         6230329d-33b6-4944-a902-249fe3f11a2c  True</p>
<p>15.2.21.3           eba68807-d550-41ae-9c0f-9b52508014fc  True</p>
<p>15.2.21.4           3a69e714-5e37-49a3-9fa2-6aba379e12f9  True</p>
<p>15.2.21.5           d24b96c4-6f81-485c-b205-947f37f96870  True</p>
<p>查看需要迁移的主机上运行的虚拟机列表（这里只是列举开机的虚拟机）</p>
<p>\&lt;acropolis> host.list_vms 6230329d-33b6-4944-a902-249fe3f11a2c</p>
<p>Not a valid command: host.lis_vms  #如果有开机虚拟机，这里会列举出来#​</p>
<p>对虚拟机进行迁移(一次可以同时迁移多个VM，VM的名称用，分开)</p>
<p>\&lt;acropolis>vm.migrate vm01,vm02 host\=”15.2.21.2” live=yes</p>
<ol start="2">
<li>主机进入维护模式：</li>
</ol>
<p>SSH到需要维护的主机的CVM虚拟机；</p>
<p>进入acli模式</p>
<p>nutanix@NTNX-J32X62B-A-CVM:15.2.21.244:\~\$ acli</p>
<p>将主机至于维护模式</p>
<p>\&lt;acropolis> host.enter_maintenance_mode 15.2.21.242</p>
<p>EnterMaintenanceMode: complete</p>
<ol start="3">
<li>关闭CVM</li>
</ol>
<p>退出acli模式</p>
<p>\&lt;acropolis> exit</p>
<p>关闭维护主机的CVM虚拟机</p>
<p>nutanix@NTNX-J32X62B-A-CVM:15.2.21.244:\~\$ cvm_shutdown -P now</p>
<p>2017-06-05 21:37:20 INFO cvm_shutdown:72 Setting up storage traffic forwarding</p>
<p>2017-06-05 21:37:20 INFO cvm_shutdown:75 Establishing Zookeeper connection...</p>
<p>2017-06-05 21:37:20 INFO zookeeper_session.py:76 Using host_port_list: zk1:9876,zk2:9876,zk3:9876</p>
<p>2017-06-05 21:37:20 INFO ipv4config.py:800 Discovered network information: hwaddr 52:54:00:18:84:93, address 15.2.21.244, netmask 255.255.255.0, gateway 15.2.21.254</p>
<p>2017-06-05 21:37:20 INFO cvm_shutdown:94 Executing cmd: sudo shutdown -P now</p>
<p>Broadcast message from nutanix@NTNX-J32X62B-A-CVM</p>
<pre><code>    (/dev/pts/0) at 21:37 ...</code></pre>
<p>The system is going down for power off NOW!</p>
<ol start="4">
<li>关闭主机</li>
</ol>
<p>SSH到需要维护的主机的操作系统；</p>
<p>查看CVM虚拟机的电源状态，确定其为power off</p>
<p>[root@NTNX-J32X62B-A \~]# virsh list --all | grep CVM</p>
<ul>
<li>NTNX-J32X62B-A-CVM             shut off</li>
</ul>
<p>将主机操作系统关机</p>
<p>[root@NTNX-J32X62B-A \~]# shutdown -h now</p>
<p>Broadcast message from root@NTNX-J32X62B-A</p>
<pre><code>    (/dev/pts/0) at 6:34 ...</code></pre>
<p>The system is going down for halt NOW!</p>
<h2>2.2 <strong>开机步骤：</strong></h2>
<ol>
<li>维护完成后，开启主机电源；</li>
<li>CVM开机</li>
</ol>
<p>默认情况下CVM在主机AHV操作系统开机后自动开启，使用以下命令检查CVM虚拟机电源状态：</p>
<p>SSH到需要维护的主机的操作系统；</p>
<p>查看CVM虚拟机的电源状态，确保状态是running</p>
<p>[root@NTNX-J32X62B-A \~]# virsh list --all | grep CVM</p>
<p>2     NTNX-J32X62B-A-CVM             running</p>
<p>如果状态始终是shut off，使用以下命令开启</p>
<p>[root@NTNX-J32X62B-A \~]# virsh start NTNX-J32X62B-A-CVM</p>
<ol start="3">
<li>主机退出维护模式</li>
</ol>
<p>SSH到需要维护的主机的CVM虚拟机；</p>
<p>进入acli模式</p>
<p>nutanix@NTNX-J32X62B-A-CVM:15.2.21.244:\~\$ acli</p>
<p>查看主机的状态信息：</p>
<p>\&lt;acropolis> host.list</p>
<p>Hypervisor address  Host UUID                             Schedulable</p>
<p>15.2.21.2           7b52e2bc-f558-4253-a00e-ba4f05cde70e  True</p>
<p>15.2.21.241         838eb59b-d48e-4f58-8029-c7dba2307f6d  True</p>
<p>15.2.21.242         6230329d-33b6-4944-a902-249fe3f11a2c  False</p>
<p>15.2.21.3           eba68807-d550-41ae-9c0f-9b52508014fc  True</p>
<p>15.2.21.4           3a69e714-5e37-49a3-9fa2-6aba379e12f9  True</p>
<p>15.2.21.5           d24b96c4-6f81-485c-b205-947f37f96870  True</p>
<p>将主机退出维护模式，并检查退出维护模式后主机的状态信息</p>
<p>\&lt;acropolis> host.exit_maintenance_mode 15.2.21.242</p>
<p>\&lt;acropolis> host.list</p>
<p>Hypervisor address  Host UUID                             Schedulable</p>
<p>15.2.21.2           7b52e2bc-f558-4253-a00e-ba4f05cde70e  True</p>
<p>15.2.21.241         838eb59b-d48e-4f58-8029-c7dba2307f6d  True</p>
<p>15.2.21.242         6230329d-33b6-4944-a902-249fe3f11a2c  True</p>
<p>15.2.21.3           eba68807-d550-41ae-9c0f-9b52508014fc  True</p>
<p>15.2.21.4           3a69e714-5e37-49a3-9fa2-6aba379e12f9  True</p>
<p>15.2.21.5           d24b96c4-6f81-485c-b205-947f37f96870  True</p>
<ol start="4">
<li>检查集群状态</li>
</ol>
<p>使用cluster status命令检查集群的状态。（需要退出acli模式）。</p>
<ol start="5">
<li>数据同步</li>
</ol>
<p>等待集群进行数据同步，在Prism管理页面主页的Data resilience状态栏中需要显示为绿色的OK（一般时间不长只需要几分钟即可同步完成）。</p>
<p>​<img src="assets/wps150-20241004113908-xqk9988.jpg" alt="" />​</p>
<ol start="6">
<li>虚拟机回迁</li>
</ol>
<p>此时可以将虚拟机回迁回主机，迁移的步骤参见停机步骤中的虚拟机迁移步骤。</p>
<p>-----结束-----</p>]]></description>
    <pubDate>Fri, 04 Oct 2024 13:29:04 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=7</guid>
</item>
<item>
    <title>关闭Nutanix集群停机方法</title>
    <link>https://www.oame2024.cn/?post=4</link>
    <description><![CDATA[<h1>关闭Nutanix集群停机方法</h1>
<p>vmware :</p>
<p>关机顺序</p>
<p>1、使用 vsphere clent 登录 vCenter 中，关闭所有的在集群中的业务虚拟机的操作系统。（最</p>
<p>后关闭 vCenter）</p>
<p>2、使用 SSH 登录到任意一台 CVM 虚拟机，执行 cluster stop 命令，关闭 Nutanix 集群</p>
<p>3、使用 SSH 依次登录到 CVM 虚拟机，执行 sudo shutdown –P now 关闭每台 cvm 虚拟机</p>
<p>4、使用 vsphere clent 依次登录 ESXi 主机，右击主机，选择关机，关闭所有 ESXi 主机</p>
<p>开机顺序：</p>
<p>1、依次开启所有 ESXi 物理主机的电源；</p>
<p>2、15 分钟后使用 SSH 登录到 CVM 虚拟机中，使用 Cluster status 命令查看集群状态，均为</p>
<p>UP 状态。如果是关闭，请使用 cluster start 命令开启 nutanix 存储集群。</p>
<p>3、使用 vsphere clent 登录 ESXi 主机，寻找 vCenter 虚拟机进行开机</p>
<p>4、5 分钟后通过 vsphere clent 登录 vCenter，开启所有业务虚拟机</p>
<p>AHV:</p>
<p>关机顺序</p>
<p>1、使用 prism 关闭所有的在集群中的业务虚拟机的操作系统。</p>
<p>2、使用 SSH 登录到任意一台 CVM 虚拟机，执行 cluster stop 命令，关闭 Nutanix 集群</p>
<p>3、使用 SSH 依次登录到 CVM 虚拟机，执行 cvm_shutdown –P now 关闭每台 cvm 虚拟机</p>
<p>4、使用 SSH 依次登录到 AHV，执行 shutdown –h now 关闭每个节点</p>
<p>开机顺序：</p>
<p>1、依次开启所有交换机、物理主机的电源；2、10 分钟后使用 SSH 登录到 CVM 虚拟机中，使用 Cluster status 命令查看集群状态，均为 UP</p>
<p>状态。如果是关闭，请使用 cluster start 命令开启 nutanix 存储集群。</p>
<p>3、登录 prism 开启所有业务虚拟机</p>]]></description>
    <pubDate>Fri, 04 Oct 2024 13:26:53 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=4</guid>
</item>
<item>
    <title>在Linux中，如何查看和管理Linux系统日志？</title>
    <link>https://www.oame2024.cn/?post=3</link>
    <description><![CDATA[<p>在Linux中，查看和管理系统日志主要有两种主要方式：利用系统自带的日志服务工具和命令行工具。以下是一些基本的操作步骤和工具：</p>
<ol>
<li>使用journalctl查看和管理systemd日志（适用于大多数现代Linux发行版）<br />
Systemd引入了systemd-journald，它以二进制格式存储日志，并提供了journalctl工具来进行查询和管理。</li>
</ol>
<p>查看所有系统日志：</p>
<p>sudo journalctl<br />
若要从最新的日志开始查看，可以加上 -r 参数：</p>
<p>sudo journalctl -r</p>
<ul>
<li><strong>按时间范围筛选日志：</strong><br />
查看过去一天的日志：
<pre><code class="language-bash">
sudo journalctl --since "1 day ago"
按服务或单元名称筛选日志：
查看特定服务的日志，比如httpd服务：</code></pre></li>
</ul>
<p>sudo journalctl -u httpd.service<br />
搜索关键词：<br />
在日志中搜索特定字符串：</p>
<p>sudo journalctl _SYSTEMD_UNIT=httpd.service | grep &quot;error&quot;<br />
实时查看日志：<br />
类似于tail -f的功能：</p>
<p><code>sudo journalctl -f</code></p>
<ol start="2">
<li>使用传统日志服务工具（如rsyslog）<br />
对于使用rsyslog的传统系统，日志文件通常位于/var/log目录下，包含messages, secure, cron, boot.log等文件。</li>
</ol>
<p>查看日志文件：<br />
查看系统全局日志：</p>
<p>less /var/log/messages<br />
或者使用tail查看最新几条日志：</p>
<p>tail /var/log/messages<br />
实时追踪日志：<br />
实时跟踪更新的日志：</p>
<p>tail -f /var/log/messages<br />
搜索日志：<br />
在日志文件中搜索特定关键词：</p>
<p>grep &quot;error&quot; /var/log/messages</p>
<ol start="3">
<li>其他日志管理工具与命令<br />
查看特定应用日志：<br />
许多应用程序会有自己的日志文件，比如Apache或Nginx的access_log和error_log：</li>
</ol>
<p>tail /var/log/apache2/error.log<br />
清理或轮转日志：<br />
使用logrotate工具定期自动压缩和清理日志文件，防止日志过大占用磁盘空间：</p>
<p>logrotate /etc/logrotate.conf  # 手动触发日志轮转<br />
查看系统启动相关的日志：</p>
<p>dmesg  # 显示内核环形缓冲区（kernel ring buffer）中的消息，包含系统启动时硬件检测和加载的消息</p>]]></description>
    <pubDate>Fri, 04 Oct 2024 08:43:00 +0800</pubDate>
    <dc:creator>orange3</dc:creator>
    <guid>https://www.oame2024.cn/?post=3</guid>
</item></channel>
</rss>