[STEP] Limitation of the amount of the file which can be opened by Linux program

Step One: In system level, set the limitation of the amount of the files which can be opened by the user who running the Linux Program

# vi /etc/security/limites.conf

Add these lines:

......
rmt  -       nofile  1024
rmt  -       nproc   1024

(Add: Setting the rmt user can open 8192 files and 8192 processes in this Linux as an example here)

Step Two: In program level, check the setting of the amount of the files which can be opened by Linux program

# /bin/systemctl show 'rmt-server-mirror.service' | sort
......
LimitNOFILE=524288
......

(Add: The amount of opening the file by program rmt-server-mirror.service is limited at 8096 as an example here)

[内容] 硬盘的模式

Write-through (直写模式)

数据同时写如 Cache (缓存) 和硬盘。
优点是:不会出现突然断电掉数据的情况
缺点是:但是写入速度较慢

Write-back (回写模式)

数据先写入 Cache (缓存) ,再从 Cache (缓存) 写入硬盘。
优点是:写入速度较快
缺点是:突然断电存储在 Cache (缓存) 里的数据无法找回

[内容] Linux 网卡状态的显示

方法一:ip 命令

# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

或者:

# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

或者:

# ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:1c:42:c9:3c:81 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.129/24 brd 10.10.10.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007/64 scope global temporary dynamic 
       valid_lft 563315sec preferred_lft 44695sec
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81/64 scope global dynamic mngtmpaddr 
       valid_lft 2591846sec preferred_lft 604646sec
    inet6 fe80::21c:42ff:fec9:3c81/64 scope link 
       valid_lft forever preferred_lft forever

方法二:ifconfig 命令

# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.10.129  netmask 255.255.255.0  broadcast 10.10.10.255
        inet6 fdb2:2c26:f4e4:0:21c:42ff:fec9:3c81  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::21c:42ff:fec9:3c81  prefixlen 64  scopeid 0x20<link>
        inet6 fdb2:2c26:f4e4:0:55da:1265:541f:8007  prefixlen 64  scopeid 0x0<global>
        ether 00:1c:42:c9:3c:81  txqueuelen 1000  (Ethernet)
        RX packets 698666  bytes 485434755 (462.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 372557  bytes 699406543 (667.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 73792  bytes 394285172 (376.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 73792  bytes 394285172 (376.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

方法三:iwconfig 命令

# iwconfig 
lo        no wireless extensions.

eth0      no wireless extensions.

[步骤] 网络的设置 (在不插网线的情况) (openSUSE & SLES 版)

正文:

方法一:通过 ip 命令实现

1.1 添加 IP 地址

1.1.1 添加 IP 地址
# ip a add 192.168.0.11/24 dev eth0

或者:

# ip a add 192.168.0.11/255.255.255.0 dev eth0

(补充:这里以给 eth0 网卡配置 IP 地址 192.168.0.11/24 为例)

1.1.2 让刚刚添加的 IP 地址生效
# ip link set dev eth0 up

(补充:这里以让 eth0 网卡上的配置生效为例)

1.2 添加网关

# ip route add default via 192.168.0.1

(补充:这里以添加 IP 地址为 192.168.0.1 的网关为例)

1.3 添加路由

# ip route add 10.0.0.0/24 via 192.168.0.254

(补充:这里以添加指向网段 10.0.0.0/24 的流量通过 IP 地址 192.168.0.254 的路由为例)

1.4 删除已有的网络设置

1.4.1 删除已配置的 IP 地址
# ip a del 192.168.0.11 dev eth0

(补充:这里以删除 eth0 网卡上的 IP 地址 192.168.0.11 为例)

1.4.2 删除已配置的网关
# ip route del default via 192.168.0.1

(补充:这以删除已配置的网关 IP 地址 192.168.0.1 为例)

1.4.3 删除已配置的路由
# ip route del 10.0.0.0/24 dev eth0

或者:

# ip route del 192.168.0.254

(补充:这里以删除在 eth0 网卡上指向网段 10.0.0.0/24 的路由或者通过 IP 地址 192.168.0.254 的路由为例)

方法二:通过网卡配置文件实现

2.1 判断 Link detected 参数是 no

# /usr/sbin/ethtool eth0

确保输出结果如下:

......
Link detected: no

否则需要在网卡配置文件中添加以下内容:

......
LINK_REQUIRED='no'

2.2 修改网卡配置文件

# vi /etc/sysconfig/network/ifcfg-eth0

添加以下内容:

BOOTPROTO='static'
IPADDR='192.168.0.10/24'
STARTMODE='auto'


补充:这里以设置
1) 使用静态 IP 地址
2) IP 地址是 192.168.1.5
3) 子网掩码是 24
4) 开机自启
为例

2.3 设置网卡 IP 地址

# vim /etc/sysconfig/network/routes

将全部内容修改如下:

default 192.168.0.1

(补充:这里以设置 192.168.0.1 为网关 IP 地址为例)

步骤四:重新启动网络服务

# service network restart

参考文献:

https://www.suse.com/support/kb/doc/?id=000019764
https://www.suse.com/support/kb/doc/?id=000019454