728x90
반응형

설치 확인

# rpm -qa | grep logrotate
logrotate-3.8.6-17.el7.x86_64

없을 때
yum instal logrotate

설정 경로

/etc/logrotate.d

각 설정 또는 예

# cat nginx
/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 nginx adm
        sharedscripts
        postrotate
                if [ -f /var/run/nginx.pid ]; then
                        kill -USR1 `cat /var/run/nginx.pid`
                fi
        endscript
}



# cat munin-node
/var/log/munin-node/munin-node.log {
	missingok
	notifempty
	copytruncate
}



# cat syslog
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
    missingok
    sharedscripts
    postrotate
	/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}



# cat zabbix-agent
/var/log/zabbix/zabbix_agentd.log {
	weekly
	rotate 12
	compress
	delaycompress
	missingok
	notifempty
	create 0664 zabbix zabbix
}

 

옵션 참조

728x90
300x250
728x90
반응형

 

find . -type l
find -L . -type l -lname '*'

# link 변경

ln -sfn /mnt/disks/mariadb-0/mysql/abc /mnt/disks/abc-1/abc/

 

728x90
300x250
728x90
반응형

yum ( rpm ) 명령어를 수행해도 진행되는 모습이 없고 Ctrl+C를 눌러도 종료되지 않을 경우의 대응방법입니다.
RPM의 DB가 손상될 수 있으므로 DB를 수정하여 지원합니다.

 

1. 일단 실행 중인 yum (rpm) 명령어는 kill 합니다.

# pkill -9 yum
# pkill -9 rpm

 

2. RPM의 DB를 삭제합니다.

# rm /var/lib/rpm/__db.*

 

3. RPM의 DB를 리빌드합니다.

# rpm --rebuilddb
728x90
300x250

'IT > OS' 카테고리의 다른 글

Linux Logrotate 설정  (0) 2021.08.09
OS내 Symbolic Link 다 찾기  (0) 2021.08.09
VM과 볼륨간 지연시 OS 대처 파라미터 설정  (0) 2021.07.30
CentOS7 Disk Mount & NFS Setting  (0) 2021.07.22
CentOS Linux Firewall (OS방화벽 설정)  (0) 2021.07.22
728x90
반응형

IO나 VolumeQueue(QueueLength)에 대해 GCP 같은 경우 OS에서 처리할 파라미터

sudo sysctl -w vm.dirty_ratio=10
sudo sysctl -w vm.dirty_background_ratio=5

참조 URL : https://www.blackmoreops.com/2014/09/22/linux-kernel-panic-issue-fix-hung_task_timeout_secs-blocked-120-seconds-problem/

728x90
300x250

'IT > OS' 카테고리의 다른 글

OS내 Symbolic Link 다 찾기  (0) 2021.08.09
yum, rpm 명령어가 응답하지 않을 때의 대응  (0) 2021.08.03
CentOS7 Disk Mount & NFS Setting  (0) 2021.07.22
CentOS Linux Firewall (OS방화벽 설정)  (0) 2021.07.22
AD 동기화 확인  (0) 2021.07.07
728x90
반응형

 

구성도 예

1. Local Disk Add
https://cloud.google.com/compute/docs/disks/local-ssd?hl=ko#create_local_ssd

 - Disk ID 확인 : DISK_ID = sdb

[root@test ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk
└─sda1   8:1    0   20G  0 part /
sdb      8:16   0  100G  0 disk
[root@test ~]#​

 

- Disk Format : ext4 file system

[root@test ~]# mkfs.ext4 -F /dev/sdb

 

- mount 디렉토리 생성 및 권한 할당

[root@test ~]# mkdir -p /mnt/disks/data
[root@test ~]# chmod a+w /mnt/disks/data

 

- mount

[root@test ~]# mount -o discard,defaults /dev/sdb /mnt/disks/data
[root@test ~]# df -k
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1       20953560 6223392  14730168  30% /
devtmpfs         3736084       0   3736084   0% /dev
tmpfs            3746604       0   3746604   0% /dev/shm
tmpfs            3746604    8604   3738000   1% /run
tmpfs            3746604       0   3746604   0% /sys/fs/cgroup
tmpfs             749324       0    749324   0% /run/user/1002
/dev/sdb       103080888   61468 103003036   1% /mnt/disks/data

 

- rebooting 시 자동 마운트 설정 : 디스크 정보 확인하고 내용을 fstab 파일에 반영

[root@test ~]# cd /etc
[root@test etc]# cp fstab fstab.backup
[root@test etc]# echo UUID=`sudo blkid -s UUID -o value /dev/sdb` /mnt/disks/data ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab
UUID=5584906b-a31c-420b-94da-fc30f94538e9 /mnt/disks/data ext4 discard,defaults,nofail 0 2
 
[root@test etc]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Wed Feb 13 19:23:27 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9adfe2b4-b4b7-454f-8d7a-4193208d0ea7 /                       xfs     defaults        0 0
/swap none swap sw 0 0
UUID=5584906b-a31c-420b-94da-fc30f94538e9 /mnt/disks/data ext4 discard,defaults,nofail 0 2
[root@test etc]#

 

2. NFS(Network file System) Server Setting

 - NFS package install

[root@test ~]# yum install nfs-utils nfs-utils-lib
 
Dependencies Resolved
 
==================================================================================================================================================================================================
 Package                                              Arch                                      Version                                             Repository                               Size
==================================================================================================================================================================================================
Installing:
 nfs-utils                                            x86_64                                    1:1.3.0-0.61.el7                                    base                                    410 k
Installing for dependencies:
 gssproxy                                             x86_64                                    0.7.0-21.el7                                        base                                    109 k
 keyutils                                             x86_64                                    1.5.8-3.el7                                         base                                     54 k
 libbasicobjects                                      x86_64                                    0.1.1-32.el7                                        base                                     26 k
 libcollection                                        x86_64                                    0.7.0-32.el7                                        base                                     42 k
 libevent                                             x86_64                                    2.0.21-4.el7                                        base                                    214 k
 libini_config                                        x86_64                                    1.3.1-32.el7                                        base                                     64 k
 libnfsidmap                                          x86_64                                    0.25-19.el7                                         base                                     50 k
 libpath_utils                                        x86_64                                    0.2.1-32.el7                                        base                                     28 k
 libref_array                                         x86_64                                    0.1.5-32.el7                                        base                                     27 k
 libverto-libevent                                    x86_64                                    0.2.5-4.el7                                         base                                    8.9 k
 
Transaction Summary
==================================================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

 

- 디스크 공유 범위 및 권한 설정

[root@test ~]# df -k
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1       20953560 6223392  14730168  30% /
devtmpfs         3736084       0   3736084   0% /dev
tmpfs            3746604       0   3746604   0% /dev/shm
tmpfs            3746604    8604   3738000   1% /run
tmpfs            3746604       0   3746604   0% /sys/fs/cgroup
tmpfs             749324       0    749324   0% /run/user/1002
/dev/sdb       103080888   61468 103003036   1% /mnt/disks/data
[root@test ~]# vi /etc/exports
/mnt/disks/data 10.1.2.0/24(rw,sync,fsid=0,no_root_squash,crossmnt,no_subtree_check,no_acl)
[root@test ~]# exportfs -a
[root@test ~]# exportfs -rv
exporting 10.1.2.0/24:/mnt/disks/data

 

- NFS Service Port 설정

[root@test ~]# vi  /etc/sysconfig/nfs
STATD_PORT=662
[root@test ~]# vi /etc/modprobe.d/lockd.conf
options lockd nlm_tcpport=4045
options lockd nlm_udpport=4045

 

- NFS Service Server 활성화

[root@test ~]# systemctl enable nfs.service
[root@test ~]# systemctl start nfs.service
[root@test ~]# systemctl enable nfs-lock.service
[root@test ~]# systemctl start nfs-lock.service
[root@test ~]# systemctl enable nfs-idmap.service
[root@test ~]# systemctl start nfs-idmap.service
[root@test ~]# systemctl enable rpcbind
[root@test ~]# systemctl start rpcbind

 

3. NFS(Network file System) Client Setting

 - NFS package install

[root@ap-0 ~]# yum install nfs-utils nfs-utils-lib
 
Dependencies Resolved
 
==================================================================================================================================================================================================
 Package                                              Arch                                      Version                                             Repository                               Size
==================================================================================================================================================================================================
Installing:
 nfs-utils                                            x86_64                                    1:1.3.0-0.61.el7                                    base                                    410 k
Installing for dependencies:
 gssproxy                                             x86_64                                    0.7.0-21.el7                                        base                                    109 k
 keyutils                                             x86_64                                    1.5.8-3.el7                                         base                                     54 k
 libbasicobjects                                      x86_64                                    0.1.1-32.el7                                        base                                     26 k
 libcollection                                        x86_64                                    0.7.0-32.el7                                        base                                     42 k
 libevent                                             x86_64                                    2.0.21-4.el7                                        base                                    214 k
 libini_config                                        x86_64                                    1.3.1-32.el7                                        base                                     64 k
 libnfsidmap                                          x86_64                                    0.25-19.el7                                         base                                     50 k
 libpath_utils                                        x86_64                                    0.2.1-32.el7                                        base                                     28 k
 libref_array                                         x86_64                                    0.1.5-32.el7                                        base                                     27 k
 libverto-libevent                                    x86_64                                    0.2.5-4.el7                                         base                                    8.9 k
 
Transaction Summary
==================================================================================================================================================================================================
Install  1 Package (+10 Dependent packages)

- 공유 디스크 확인

[root@ap-0 ~]# showmount -e 10.1.2.3
Export list for 10.1.2.3:
/mnt/disks/data 10.1.2.0/24

참고 : NFS disk 가 보이지 않을 경우 https://access.redhat.com/solutions/2798411 참조하여 공유 Server 설정을 변경 할 것

 

- mount 디렉토리 생성 및 권한 할당 : 

[root@ap-0 ~]# mkdir -p /mnt/disks/data
[root@ap-0 ~]# chmod a+w /mnt/disks/data

 

- rebooting 시 자동 마운트 설정

[root@ap-0 ~]# cd /etc
[root@ap-0 etc]# cp fstab fstab.backup
[root@ap-0 etc]# vi fstab
#
# /etc/fstab
# Created by anaconda on Wed Feb 13 19:23:27 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=9adfe2b4-b4b7-454f-8d7a-4193208d0ea7 /                       xfs     defaults        0 0
/swap none swap sw 0 0
10.1.2.3:/mnt/disks/data /mnt/disks/data nfs rw 0 0

 

- NFS Service Client 활성화

[root@ap-0 ~]# systemctl enable nfs-rquotad.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rpc-rquotad.service to /usr/lib/systemd/system/rpc-rquotad.service.
Created symlink from /etc/systemd/system/nfs-server.service.wants/rpc-rquotad.service to /usr/lib/systemd/system/rpc-rquotad.service.
[root@ap-0 ~]# systemctl start nfs-rquotad.service
[root@ap-0 ~]# dracut -v -f
[root@ap-0 ~]# reboot
728x90
300x250
728x90
반응형

Linux 7 

1. 추가
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="0.0.0.0/0" service name="http" accept'
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="1.1.1.1" port port="22" protocol="tcp" accept'

2. 리스트 확인
firewall-cmd --zone=public --list-all

3. 설정 후 reload
firewall-cmd --reload

4. 삭제
firewall-cmd --permanent --zone=public --remove-rich-rule='rule family="ipv4" source address="1.1.1.1" port port="22" protocol="tcp" accept'

 

Linux 6

1. 추가
iptables -I RH-Firewall-1-INPUT 10 -s 1.214.220.9/32 -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT

2. 삭제
iptables -D RH-Firewall-1-INPUT -s 1.231.85.46 -j ACCEPT

3. 저장
service iptables save

4. 재시작
service iptables restart
728x90
300x250

'IT > OS' 카테고리의 다른 글

VM과 볼륨간 지연시 OS 대처 파라미터 설정  (0) 2021.07.30
CentOS7 Disk Mount & NFS Setting  (0) 2021.07.22
AD 동기화 확인  (0) 2021.07.07
OS xfs 파일시스템 용량 증설  (0) 2021.07.04
리눅스 Time 문자열 값 date 변환  (0) 2021.07.01
728x90
반응형

ad 동기화 확인

repadmin /showrepl

 

ad 복제 확인

repadmin /replsummary

728x90
300x250
728x90
반응형
[root@test /]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0  200G  0 disk
└─nvme0n1p1 259:1    0  100G  0 part /
 
[root@test /]# growpart /dev/nvme0n1 1
CHANGED: partition=1 start=2048 old: size=209713119 end=209715167 new: size=419428319 end=419430367
 
[root@test /]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
nvme0n1     259:0    0  200G  0 disk
└─nvme0n1p1 259:1    0  200G  0 part /
 
[root@test /]# xfs_growfs -d /
meta-data=/dev/nvme0n1p1         isize=512    agcount=51, agsize=524224 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=26214139, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 26214139 to 52428539
 
[root@test /]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        7.6G     0  7.6G   0% /dev
tmpfs           7.7G     0  7.7G   0% /dev/shm
tmpfs           7.7G  401M  7.3G   6% /run
tmpfs           7.7G     0  7.7G   0% /sys/fs/cgroup
/dev/nvme0n1p1  200G   83G  118G  42% /
tmpfs           1.6G     0  1.6G   0% /run/user/1001
728x90
300x250

+ Recent posts