2019年11月22日 星期五

CentOS 8 安裝及使用 MegaCLI

以下參考Google 到的資訊,不過因為用到 libncurses.so.5,好像只能在 CentOS 7 上使用。

Step 1: Verify Your Hardware RAID Controller

執行下列指令,可得到 RAID controller 的資訊。
# lspci | grep -i raid
1a:00.0 RAID bus controller: Broadcom / LSI MegaRAID SAS-3 3108 [Invader] (rev 02)

Step 2: Download MegaCLI 

下載網址
Support Documents and Downloads

[Expand All],找到並下載最後版本的 MegaCLI
unzip 後,到 Linux 的目錄下,執行安裝。並且建立 alias 方便使用
# yum localinstall MegaCli-8.07.14-1.noarch.rpm
# alias megacli='/opt/MegaRAID/MegaCli/MegaCli64'
# ln -sf /opt/MegaRAID/MegaCli/MegaCli64 /usr/bin/megacli
# megacli

/opt/MegaRAID/MegaCli/MegaCli64: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

]# ls /usr/lib64/libncur*
/usr/lib64/libncurses.so.6    /usr/lib64/libncursesw.so.6
/usr/lib64/libncurses.so.6.1  /usr/lib64/libncursesw.so.6.1

經網友指正,執行下列指令,安裝 ncurses-compat-libs,即可解決上述問題
# dnf install ncurses-compat-libs

透過 docker 來執行

那就裝 docker 吧
參考網址  How to install Docker CE on RHEL 8 / CentOS 8


由於 containerd.io 的版本問題,只能裝較舊的版本
$ sudo dnf install docker-ce-3:18.09.1-3.el7
不過在 update 時,必須排除 docker-ce 相關的 package,另外 podman* 會造成衝突也要排除
$ sudo yum update exclude=docker* exclude=podman*

然後裝 docker-compose
$ curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
把它加上執行權限,然後移到 /usr/local/bin 的目錄下

然後就可以用 megacli 了
$ docker run --rm -ti --privileged kamermans/docker-megacli
      MegaCLI SAS RAID Management Tool  Ver 8.07.14 Dec 16, 2013
      Storage Command Line Tool  Ver 1.03.11 Jan 30, 2013
[root@6873acd250e5 megacli]# megacli -PDList -aALL -Nolog|grep '^Firm'
Firmware state: JBOD
Firmware state: Online, Spun Up
Firmware state: Online, Spun Up
[root@6873acd250e5 megacli]#
就這樣子了

進一步的使用說明可參考 LSI MegaRAID SAS








2019年11月12日 星期二

Docker 無法啟動

有好一陣子沒用自己電腦的 docker 了,今天想改個系統,道然無法啟動 docker 了。
只用 systemctl status docker.service
實在看不出問題出在那裡。

找到下面的網頁,照著下面的指令可以查詳細的 log 資訊。
https://forum.manjaro.org/t/docker-service-cant-start-solved/93410/3

sudo journalctl --no-hostname --no-pager -b -u docker.service

非常多的訊息,慢慢追,直到下面這段訊息,就跳出來了
11月 13 15:24:36 dockerd[21959]: Error starting daemon: Devices cgroup isn't mounted

用上面的訊息再 Google,找到這個網頁,似乎和 systemd 有關。
https://github.com/docker/cli/issues/2104

Found the "bug"...
I forgot to mention in my previous comment that I use(d) systemd version 243.
With systemd 242 works everything flawlessly... :)
From the systemd changelog:
        * systemd now defaults to the "unified" cgroup hierarchy setup during
          build-time, i.e. -Ddefault-hierarchy=unified is now the build-time
          default. Previously, -Ddefault-hierarchy=hybrid was the default. This
          change reflects the fact that cgroupsv2 support has matured
          substantially in both systemd and in the kernel, and is clearly the
          way forward. Downstream production distributions might want to
          continue to use -Ddefault-hierarchy=hybrid (or even =legacy) for
          their builds as unfortunately the popular container managers have not
          caught up with the kernel API changes.
Sooo... Houston, we have a problem:
  1. systemd will (or already did) jump on the cgroupsv2 bandwagon...
  2. cgroupfs-mount tools does not work with newer systemd setups.
"Same" issue in kubernetes

再查 Gentoo 的 docker wiki,發現關於 systemd 的說明,要加上 USE flag: cgroup-hybrid。加上後重新 emerge,再重開就 OK 了。

https://wiki.gentoo.org/wiki/Docker#systemd

Docker service fails because cgroup device not mounted (systemd)

By default systemd uses hybrid cgroup hierarchy combining cgroup and cgroup2 devices. Docker still needs cgroup(v1) devices. Activate USE flag cgroup-hybrid for systemd.
Activate USE flag for systemd
FILE /etc/portage/package.use/systemd
sys-apps/systemd cgroup-hybrid
Install systemd with the new USE flags
root #emerge --ask --oneshot sys-apps/systemd



2019年11月7日 星期四

PostgreSQL 維護


SELECT pg_size_pretty( pg_database_size('dspace_getcdb_tst') );
pg_size_pretty: "2112 MB"


SELECT pg_size_pretty( pg_total_relation_size('bitstream') );
pg_size_pretty: "57 MB"



vacuum verbose analyze metadatavalue


Vacuum 前
metadatavalue
Table Size 320 MB
Toast Table Size 9480 kB
Indexes Size 376 MB

執行 Vacuum 指令
vacuum full verbose metadatavalue
INFO:  vacuuming "public.metadatavalue"
INFO:  "metadatavalue": found 1256 removable, 11800 nonremovable row versions in 40949 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU 0.35s/0.15u sec elapsed 0.50 sec.
Query returned successfully with no result in 693 ms.

Vacuum 後
metadatavalue
Table Size 2768 kB
Toast Table Size 7840 kB
Indexes Size 1120 kB


網誌存檔