2024年4月26日金曜日

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service
[Unit]
Description= stop httpgwd
DefaultDependencies=no
Before=shutdown.target
RefuseManualStart=true

[Service]
Type=oneshot
ExecStart= /usr/local/sbin/httpgwd  stop
[Install]
WantedBy=shutdown.target

# systemctl daemon-reload
# systemctl enable drop.service

2024年4月25日木曜日

Postgres partition 設定 パーティション設定

SET client_encoding TO 'UTF8';
SET search_path = arcsdbss,public;

CREATE TABLE sst008_p202403 PARTITION OF sst008
FOR VALUES FROM ('20240301000000000') TO ('20240401000000000')
PARTITION BY HASH (gcode, ccode, scode);
CREATE TABLE sst008_sys_subp202403_0 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 0);
CREATE TABLE sst008_sys_subp202403_1 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 1);
CREATE TABLE sst008_sys_subp202403_2 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 2);
CREATE TABLE sst008_sys_subp202403_3 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 3);
CREATE TABLE sst008_sys_subp202403_4 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 4);
CREATE TABLE sst008_sys_subp202403_5 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 5);
CREATE TABLE sst008_sys_subp202403_6 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 6);
CREATE TABLE sst008_sys_subp202403_7 PARTITION OF sst008_p202403
FOR VALUES WITH (MODULUS 8, REMAINDER 7);

CREATE TABLE sst008_p202404 PARTITION OF sst008
FOR VALUES FROM ('20240401000000000') TO ('20240501000000000')
PARTITION BY HASH (gcode, ccode, scode);
CREATE TABLE sst008_sys_subp202404_0 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 0);
CREATE TABLE sst008_sys_subp202404_1 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 1);
CREATE TABLE sst008_sys_subp202404_2 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 2);
CREATE TABLE sst008_sys_subp202404_3 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 3);
CREATE TABLE sst008_sys_subp202404_4 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 4);
CREATE TABLE sst008_sys_subp202404_5 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 5);
CREATE TABLE sst008_sys_subp202404_6 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 6);
CREATE TABLE sst008_sys_subp202404_7 PARTITION OF sst008_p202404
FOR VALUES WITH (MODULUS 8, REMAINDER 7);

CREATE TABLE sst008_p202405 PARTITION OF sst008
FOR VALUES FROM ('20240501000000000') TO ('20240601000000000')
PARTITION BY HASH (gcode, ccode, scode);
CREATE TABLE sst008_sys_subp202405_0 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 0);
CREATE TABLE sst008_sys_subp202405_1 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 1);
CREATE TABLE sst008_sys_subp202405_2 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 2);
CREATE TABLE sst008_sys_subp202405_3 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 3);
CREATE TABLE sst008_sys_subp202405_4 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 4);
CREATE TABLE sst008_sys_subp202405_5 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 5);
CREATE TABLE sst008_sys_subp202405_6 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 6);
CREATE TABLE sst008_sys_subp202405_7 PARTITION OF sst008_p202405
FOR VALUES WITH (MODULUS 8, REMAINDER 7);

CREATE TABLE sst008_p202406 PARTITION OF sst008
FOR VALUES FROM ('20240601000000000') TO ('20240701000000000')
PARTITION BY HASH (gcode, ccode, scode);
CREATE TABLE sst008_sys_subp202406_0 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 0);
CREATE TABLE sst008_sys_subp202406_1 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 1);
CREATE TABLE sst008_sys_subp202406_2 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 2);
CREATE TABLE sst008_sys_subp202406_3 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 3);
CREATE TABLE sst008_sys_subp202406_4 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 4);
CREATE TABLE sst008_sys_subp202406_5 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 5);
CREATE TABLE sst008_sys_subp202406_6 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 6);
CREATE TABLE sst008_sys_subp202406_7 PARTITION OF sst008_p202406
FOR VALUES WITH (MODULUS 8, REMAINDER 7);

CREATE TABLE sst008_sys_subp202406_default PARTITION OF sst008 DEFAULT;

2024年4月19日金曜日

Failed to load SELinux policy

grab

load_video
set fgxpayload=keep
insmod gzio
linux ($root)/vmlinz-5.14.0-362.24.1.e19_3.x86_64 root=/dev/m,apper/r1-root\
ro crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M resume=/dev/mapper/r1-swap\
rd.lvm.lv=r1/root fd.lvm.lv=rl/swap seliux=0
initrd ($root)/initramfs-5.14-0-362.24.1.e19_3.x86_64.img

cntl-x

2024年4月17日水曜日

bash 履歴保管

$ vi .bashrc
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

2024年4月5日金曜日

ESXi停止

[root@localhost:~] vim-cmd vmsvc/getallvms
Vmid Name File Guest OS Version Annotation
37 changesv2n [office-vmfs] changesv2n/changesv2n.vmx windows8Server64Guest vmx-11
38 changesv1n [office-vmfs] changesv1n/changesv1n.vmx windows8Server64Guest vmx-11
39 linksv1n [office-vmfs] linksv1n_1/linksv1n.vmx centos64Guest vmx-11
[root@localhost:~] vim-cmd vmsvc/power.shutdown 39
[root@localhost:~] vim-cmd vmsvc/power.getstate 39
Retrieved runtime info
Powered off
[root@localhost:~] esxcli system maintenanceMode get
Disabled
[root@localhost:~] esxcli system maintenanceMode set --enable true
[root@localhost:~] esxcli system shutdown poweroff -r hard_trouble


2024年4月2日火曜日

postgres エクスポート pg_dump / pg_restore

$ pg_dump -Fc -h localhost -p 5432 -U postgres -d arcsdbms > arcsdbms.dump
$ time pg_restore -h 10.0.18.102 -p 5432 -U postgres -d arcsdbms arcsdbms.dump

zabbix7 amazon linux2023 インストール postgres15

【postgres】 dnf -y install postgresql15-server postgresql15-server-devel postgresql-setup initdb passwd postgres vi `find / -name pg_hba.con...