突然のトラブルによりLightsailのインスタンスを急遽引っ越しました(2022/01改版)。

突然のトラブルによりLightsailのインスタンスを急遽引っ越しました(2022/01改版)。

8月1日、徒労日記が止まりました。
どうして・・・

2022/01/06 更新
再び不具合発生のため、WordPress5.8.2-4でインスタンスを再作成しました。
変更になっている部分を修正してあります。

Blog停止の原因

8月1日の早朝からAWS=LightsailのCPUメトリクスが高負荷を示していました。
長く待てばサイトにはアクセスできるものの、Jetpackからサイト異常を知らせるメールがバンバン来ます。

タイミングを確認するとBackWPupによる月イチのフルバックアップが起動したあたり。
一応DDoS攻撃も確認したけれどログに痕跡はありません。

BackWPupのジョブリストによるとバックアップは終わっていたけれど、MySQLの高負荷が止まらない。
実際にはメモリが肥大した結果Swapが拡大し、I/O待ちが続いているようです。
なにせ512MBだしね。

一度MySQL,php-fpm,Apacheを停止し、MySQLだけ起動。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# /opt/bitnami/ctlscript.sh stop
# /opt/bitnami/ctlscript.sh start mysql
# /opt/bitnami/ctlscript.sh stop # /opt/bitnami/ctlscript.sh start mysql
# /opt/bitnami/ctlscript.sh stop
# /opt/bitnami/ctlscript.sh start mysql

その後mysqlcheckでDBチェック。
一部修正がありリペアをかけたものの、結果は変わらず。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mysqlcheck -c -u root -p --all-databases
# mysqlcheck -r -u root -p --all-databases
# mysqlcheck -c -u root -p --all-databases # mysqlcheck -r -u root -p --all-databases
# mysqlcheck -c -u root -p --all-databases
# mysqlcheck -r -u root -p --all-databases

Apacheを起動した瞬間、再び高負荷状態に陥ります。

DBを作り直せば直るかもしれないけれど、「かもしれない」にかけてる時間が勿体ない状況。

「PHPのバージョンが古い」って怒られてたし、いい機会と思って新インスタンスを作る事にしました。(依存性の関係でbitnamiのVMイメージはPHPのアップデートが実質不可能らしい)

引越:旧インスタンスでの作業

旧マシンでやる事は過去何度もやってきたBlogバックアップです。

ファイルのフルバックアップ

BackwpUpフォルダを除外(事前削除)して保存します。取れたら一応中身確認。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# tar cvzf FullBackup.tar.gz /opt/bitnami/apps/wordpress/htdocs
# tar tvzf FullBackup.tar.gz
# tar cvzf FullBackup.tar.gz /opt/bitnami/apps/wordpress/htdocs # tar tvzf FullBackup.tar.gz
# tar cvzf FullBackup.tar.gz /opt/bitnami/apps/wordpress/htdocs
# tar tvzf FullBackup.tar.gz

VM間コピーはせず、素直にTeratermでローカルにSCPダウンロードしておきます。

DBのバックアップ

rootのパスワード(VMとMySQLは共通)を確認し、WordpressのDBだけバックアップします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ cat /home/bitnami/bitnami_application_password
# mysqldump -u root -p --databases bitnami_wordpress > mysqldump_bitnamiwp.sql
$ cat /home/bitnami/bitnami_application_password # mysqldump -u root -p --databases bitnami_wordpress > mysqldump_bitnamiwp.sql
$ cat /home/bitnami/bitnami_application_password
# mysqldump -u root -p --databases bitnami_wordpress > mysqldump_bitnamiwp.sql

同じくローカルに持ってきておきます。

インスタンスの停止

普通にシャットダウン。
が、グローバルIPはまだ旧インスタンスにつけておきます。

フリーな状態が続くと課金対象となるため。

引越:新インスタンスでの作業

新しいインスタンスの払い出し

春ですね。さくらVPS荘を追い出されたのでメゾンLightsailに引っ越しました。

今回はアカウントやらDNSやらは設定済みなのですぐに終わりました。
同じリージョンで作成する場合、SSHキー(.pemファイル)を再取得する必要はありません。

グローバルIPの移行

旧インスタンスに振られていたグローバルIPを新インスタンスに引き継ぎます。
一時的に取り外したとしても、使っていたグローバルIPは消えません。

  1. 旧インスタンスの”ネットワーク”を開き、”パブリックIP”の[デタッチ]をクリック。
  2. 新インスタンスの”ネットワーク”を開き、{静的IPのアタッチ]をクリック
  3. 既存のアドレスリスト(デフォルトではStaticIp-1)を選択して[アタッチ]。

これでTeratermを使って新インスタンスへアクセスできるようになりました。

Let’s Encryptによる証明書入手

今回一番手間取ったのは間違いなくLet’s Encrypt。

最初は前回のやり方、といっても一年前の手順をなぞってみた。
けれども「このツールは使えない」と表示されて頓挫。

結局Amazonが公開しているチュートリアルの手法を頼りました。

手順は丁寧に書かれているけれど、以前とアプローチが全く違います。

まず【ステップ.2】のcertbotをインストール。リポジトリの追加は不要。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt-get update
# apt-get install software-properties-common
# apt-get install certbot -y
# apt-get update # apt-get install software-properties-common # apt-get install certbot -y
# apt-get update
# apt-get install software-properties-common
# apt-get install certbot -y

【ステップ.3】は「SSLワイルドカード証明書の取得」なる手順。
後ほどシステムが承認のためサブドメインを使ってアクセスしてくるから、それにもSSL対応できる証明書を取得する、と理解しました。

まず環境変数を指定

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# DOMAIN=dolls.tokyo
# WILDCARD=*.$DOMAIN
# echo $DOMAIN && echo $WILDCARD
dolls.tokyo
*.dolls.tokyo
# DOMAIN=dolls.tokyo # WILDCARD=*.$DOMAIN # echo $DOMAIN && echo $WILDCARD dolls.tokyo *.dolls.tokyo
# DOMAIN=dolls.tokyo
# WILDCARD=*.$DOMAIN
# echo $DOMAIN && echo $WILDCARD
dolls.tokyo
*.dolls.tokyo

そして発行コマンドを実行。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# certbot -d $DOMAIN -d $WILDCARD --manual --preferred-challenges dns certonly
# certbot -d $DOMAIN -d $WILDCARD --manual --preferred-challenges dns certonly
# certbot -d $DOMAIN -d $WILDCARD --manual --preferred-challenges dns certonly

このコマンドは対話形式で進みますが、注意が必要。
メッセージを読みながらサイトに設定を反映し、準備が出来たらメッセージを進めてチェックを受ける、という手順をふみます。

一気にEnterを押して読み進めてしまうと失敗します。
ただし何度もトライできるので、落ち着いて設定すれば大丈夫。

メールアドレスの入力、ログの使用に同意(Y)したら”Press Enter to Continue”で一旦止めます。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
your server, please ensure you're okay with that.
Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.dolls.tokyo with the following value:
XXXXXXXXXYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZ
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
your server, please ensure you're okay with that. Are you OK with your IP being logged? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please deploy a DNS TXT record under the name _acme-challenge.dolls.tokyo with the following value: XXXXXXXXXYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZ Before continuing, verify the record is deployed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Press Enter to Continue
your server, please ensure you're okay with that.

Are you OK with your IP being logged?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: y

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please deploy a DNS TXT record under the name
_acme-challenge.dolls.tokyo with the following value:

XXXXXXXXXYYYYYYYYYYYYYYYYZZZZZZZZZZZZZZZZZ

Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue

これは「”_acme-challenge.dolls.tokyo”というDNSリクエストを投げたら、以下の文字列(XXXYYYZZZで隠してる部分)を返すように設定しなさいよ。」という事です。
これはほぼ2回表示されるため、Enterを1回押し2つのTXTレコードを表示させてからAWSコンソールにてDNSの設定を実施します。

【ステップ.4】に進み、上記サブドメイン(_acme-challenge)、文字列(XXXXYYYZZZ)を[TXT レコード.] として追加しますx2行。

【ステップ.5】でhttps://mxtoolbox.com/TXTLookup.aspxへアクセスし、DNSレコードが反映したかをチェック。

ここまでやって、先程止めていたコマンドでEnterを押して進めます。
うまくDNSの問い合せが返せたら、完了のメッセージが表示され終わります。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/dolls.tokyo/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/dolls.tokyo/privkey.pem
Your cert will expire on 2021-10-30. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew *all* of your certificates, run
"certbot renew"
- If you like Certbot, please consider supporting our work by:
Before continuing, verify the record is deployed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Press Enter to Continue Waiting for verification... Cleaning up challenges IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/dolls.tokyo/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/dolls.tokyo/privkey.pem Your cert will expire on 2021-10-30. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - If you like Certbot, please consider supporting our work by:
Before continuing, verify the record is deployed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press Enter to Continue
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/dolls.tokyo/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/dolls.tokyo/privkey.pem
   Your cert will expire on 2021-10-30. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - If you like Certbot, please consider supporting our work by:

以前はサイト内にテキストファイルを置いて、そこへアクセスしてもらう事で自己を証明していました。
今回のやり方の方がhttpd.confの例外も不要なためスマートです。

最後は【ステップ.7】でファイルの配置をして完了。
WordPress5.8.2-4からファイルパスが変わりました。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# echo $DOMAIN
dolls.tokyo
#
# mv /opt/bitnami/apache/conf/bitnami/certs/server.key /opt/bitnami/apache/conf/bitnami/certs/server.key.old
# ln -s /etc/letsencrypt/live/$DOMAIN/privkey.pem /opt/bitnami/apache/conf/bitnami/certs/server.key
#
# mv /opt/bitnami/apache/conf/bitnami/certs/server.crt /opt/bitnami/apache/conf/bitnami/certs/server.crt.old
# ln -s /etc/letsencrypt/live/$DOMAIN/fullchain.pem /opt/bitnami/apache/conf/bitnami/certs/server.crt
#
# /opt/bitnami/ctlscript.sh start
# echo $DOMAIN dolls.tokyo # # mv /opt/bitnami/apache/conf/bitnami/certs/server.key /opt/bitnami/apache/conf/bitnami/certs/server.key.old # ln -s /etc/letsencrypt/live/$DOMAIN/privkey.pem /opt/bitnami/apache/conf/bitnami/certs/server.key # # mv /opt/bitnami/apache/conf/bitnami/certs/server.crt /opt/bitnami/apache/conf/bitnami/certs/server.crt.old # ln -s /etc/letsencrypt/live/$DOMAIN/fullchain.pem /opt/bitnami/apache/conf/bitnami/certs/server.crt # # /opt/bitnami/ctlscript.sh start
# echo $DOMAIN
dolls.tokyo
#
# mv /opt/bitnami/apache/conf/bitnami/certs/server.key /opt/bitnami/apache/conf/bitnami/certs/server.key.old
# ln -s /etc/letsencrypt/live/$DOMAIN/privkey.pem /opt/bitnami/apache/conf/bitnami/certs/server.key
#
# mv /opt/bitnami/apache/conf/bitnami/certs/server.crt /opt/bitnami/apache/conf/bitnami/certs/server.crt.old
# ln -s /etc/letsencrypt/live/$DOMAIN/fullchain.pem /opt/bitnami/apache/conf/bitnami/certs/server.crt
#
# /opt/bitnami/ctlscript.sh start

これまで使われていたapache2というディレクトリはapacheへのシンボリックリンクになっています。

常時SSL

チュートリアルでおすすめされているReally Simple SSLプラグインは使用せず、手書きでhttp→https化します。
2022/01現在設定を書き換えるべきファイルは/opt/bitnami/apache/conf/vhosts/wordpress-vhost.confでした。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ vi /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
<VirtualHost 127.0.0.1:80 _default_:80>
ServerAlias *
DocumentRoot /home/dollstokyo/www/dolls.tokyo
<Directory "/home/dollstokyo/www/dolls.tokyo">
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
# BEGIN WordPress fix for plugins and themes
# https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43
RewriteEngine On
RewriteRule ^bitnami/wordpress(/.*) $1 [L]
# END WordPress fix for plugins and themes
# BEGIN WordPress
# https://wordpress.org/support/article/htaccess/#basic-wp
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
#※追記ここから
# http to https redirect 2022-01-12
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#追記ここまで
</Directory>
</VirtualHost>
$ vi /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf <VirtualHost 127.0.0.1:80 _default_:80> ServerAlias * DocumentRoot /home/dollstokyo/www/dolls.tokyo <Directory "/home/dollstokyo/www/dolls.tokyo"> Options -Indexes +FollowSymLinks -MultiViews AllowOverride None Require all granted # BEGIN WordPress fix for plugins and themes # https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43 RewriteEngine On RewriteRule ^bitnami/wordpress(/.*) $1 [L] # END WordPress fix for plugins and themes # BEGIN WordPress # https://wordpress.org/support/article/htaccess/#basic-wp RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress #※追記ここから # http to https redirect 2022-01-12 RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] #追記ここまで </Directory> </VirtualHost>
$ vi /opt/bitnami/apache/conf/vhosts/wordpress-vhost.conf
<VirtualHost 127.0.0.1:80 _default_:80>
  ServerAlias *
  DocumentRoot /home/dollstokyo/www/dolls.tokyo
  <Directory "/home/dollstokyo/www/dolls.tokyo">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride None
    Require all granted
    # BEGIN WordPress fix for plugins and themes
    # https://github.com/bitnami/bitnami-docker-wordpress-nginx/issues/43
    RewriteEngine On
    RewriteRule ^bitnami/wordpress(/.*) $1 [L]
    # END WordPress fix for plugins and themes
    # BEGIN WordPress
    # https://wordpress.org/support/article/htaccess/#basic-wp
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # END WordPress
    
    #※追記ここから
    # http to https redirect 2022-01-12
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    #追記ここまで

  </Directory>
</VirtualHost>

これによりアクセスは自動的にhttpからhttpsへ転送されます。
しかしWordpress自身の管理画面URLをhttps化するのはwp-config.phpの編集が必要。

Jetpackのサイト誤認識を防ぐためにも、変数ではなく直接http://dolls.tokyo/と記載します。

ファイルの復元

あとはSCPで下記戻したファイルを配置したら終了です。
WordPress5.8.2-4からはイメージのWordpressを最大限残し、wp-content配下だけマージしました。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# mkdir /tmp/work
# tar xvzf FullBackup.tar.gz -C /tmp/work
#
# cd /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/wp-content
# sudo cp -r plugins/* /home/dollstokyo/www/dolls.tokyo/wp-content/plugins
# sudo cp -r themes/* /home/dollstokyo/www/dolls.tokyo/wp-content/themes
# sudo cp -r uploads/* /home/dollstokyo/www/dolls.tokyo/wp-content/uploads
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/plugins/
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/themes/
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/uploads/
#
# cat /home/bitnami/bitnami_application_password
# mysql -u root -p -D bitnami_wordpress < mysqldump_bitnamiwp.sql
# mkdir /tmp/work # tar xvzf FullBackup.tar.gz -C /tmp/work # # cd /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/wp-content # sudo cp -r plugins/* /home/dollstokyo/www/dolls.tokyo/wp-content/plugins # sudo cp -r themes/* /home/dollstokyo/www/dolls.tokyo/wp-content/themes # sudo cp -r uploads/* /home/dollstokyo/www/dolls.tokyo/wp-content/uploads # sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/plugins/ # sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/themes/ # sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/uploads/ # # cat /home/bitnami/bitnami_application_password # mysql -u root -p -D bitnami_wordpress < mysqldump_bitnamiwp.sql
# mkdir /tmp/work
# tar xvzf FullBackup.tar.gz -C /tmp/work
# 
# cd /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/wp-content
# sudo cp -r plugins/* /home/dollstokyo/www/dolls.tokyo/wp-content/plugins
# sudo cp -r themes/* /home/dollstokyo/www/dolls.tokyo/wp-content/themes
# sudo cp -r uploads/* /home/dollstokyo/www/dolls.tokyo/wp-content/uploads
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/plugins/
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/themes/
# sudo chown -R bitnami:daemon /home/dollstokyo/www/dolls.tokyo/wp-content/uploads/
# 
# cat /home/bitnami/bitnami_application_password
# mysql -u root -p -D bitnami_wordpress < mysqldump_bitnamiwp.sql

このやり方であれば、過去あった「新しいDBのパスワードが書かれたwp-config.phpを消してしまった!」という事はありません。

また、イメージに含まれていたWordpressをそのまま使う場合は以下も必要。
ファビコンの移動と、サイトURLのhttps化です(設定画面ではグレーアウト)

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo cp /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/favicon.ico /home/dollstokyo/www/dolls.tokyo/
$
$ sudo vi wp-config.php
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
$ sudo /opt/bitnami/ctlscript.sh restart apache
$ sudo cp /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/favicon.ico /home/dollstokyo/www/dolls.tokyo/ $ $ sudo vi wp-config.php define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' ); define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' ); $ sudo /opt/bitnami/ctlscript.sh restart apache
$ sudo cp /tmp/workspace/opt/bitnami/apps/wordpress/htdocs/favicon.ico /home/dollstokyo/www/dolls.tokyo/
$
$ sudo vi wp-config.php

define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/' );

$ sudo /opt/bitnami/ctlscript.sh restart apache

ディレクトリパーミションの変更

2022年1月時点でのbitnamiイメージのapacheはオーナー情報がdaemon:daemonです。

もしインポートしたファイルがbitnami:daemonの場合は変更が必要。
そうしないとプラグインの更新に失敗したり、Jetpackが実は動いてなかったり、BackWPupのジョブが失敗したりします。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ sudo chmod -R 705 uploads/
$ sudo chown -R daemon:daemon uploads
$ sudo chmod -R 705 plugins/
$ sudo chown -R daemon:daemon plugins
$ sudo chmod -R 705 uploads/ $ sudo chown -R daemon:daemon uploads $ sudo chmod -R 705 plugins/ $ sudo chown -R daemon:daemon plugins
$ sudo chmod -R 705 uploads/
$ sudo chown -R daemon:daemon uploads
$ sudo chmod -R 705 plugins/
$ sudo chown -R daemon:daemon plugins

これを終わらせた後、管理画面をリロードしてJetpackが文句を言わないか確認。
「2つのサイトが見つかりました。セーフモードに・・・」と出たら一度接続を解除し、再度サイトとリンクさせます。

補助作業

「Jetpack 接続トークンが無効です」対応

管理画面へログインし、全てのプラグインを有効化。
これで完璧に戻った!

と思ったらサイトヘルスがJetpackエラーのため黄色表示となっていました。
内容は”Connection Token Error”。

そこで表示される「Jetpackの再接続」は何度試してもだめ。

結局左メニューにある”Jetpack”から”ダッシュボード”を選び、一番右下に表示されている”デバック”をクリック。
デバックセンターの下の方にある”Wordpress.comから切断”をクリック。

すると1から認証する処理画面が開かれ、無事復旧できました。
サイトヘルスも良好をGET(PHP7.3が古い、という警告もなくなりました)

bitnamiバナーの無効化

WordPress5.8.2-4では当作業は不要でした。最初からバナーなし。
一応履歴として残しておきます。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
# /opt/bitnami/ctlscript.sh restart apachek
# /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1 # /opt/bitnami/ctlscript.sh restart apachek
# /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1
# /opt/bitnami/ctlscript.sh restart apachek

TLS1.0&TLS1.1Lの無効化

今回のbitnamiイメージも初期値ではTLS1.0&TLS1.1が有効化され、SSL Server Testで脆弱性アリの判定を受けます。
よって今回も無効化しました。

Lightsailで動くWordPressのTLS1.0&TLS1.1を無効化してSSL Server TestでAをもらう

旧インスタンスの削除

これをやらないと停止していても課金されるそうです。
全部の確認が終わったら、速やかに旧インスタンスを削除します。

これにて無事完了です。

最新インスタンスでスピードアップ

使ってみて思ったんですが「速くなってる?」
各ページへのアクセスも、サクサクです。

ベンチマークしてみたらたしかに上がってました。
まずはGoogleのLighthouse

時間帯に限らず90~93をマーク。1年前の構築時のスコアは81でした

つづいてab。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ ab -n 1000 -c 100 http://dolls.tokyo/
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
中略
Server Software: Apache
Server Hostname: dolls.tokyo
Server Port: 443
SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
Server Temp Key: X25519 253 bits
TLS Server Name: dolls.tokyo
Document Path: /
Document Length: 66030 bytes
Concurrency Level: 100
Time taken for tests: 39.862 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 66341000 bytes
HTML transferred: 66030000 bytes
Requests per second: 25.09 [#/sec] (mean)
Time per request: 3986.222 [ms] (mean)
Time per request: 39.862 [ms] (mean, across all concurrent requests)
Transfer rate: 1625.25 [Kbytes/sec] received
$ ab -n 1000 -c 100 http://dolls.tokyo/ This is ApacheBench, Version 2.3 <$Revision: 1879490 $> 中略 Server Software: Apache Server Hostname: dolls.tokyo Server Port: 443 SSL/TLS Protocol: TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256 Server Temp Key: X25519 253 bits TLS Server Name: dolls.tokyo Document Path: / Document Length: 66030 bytes Concurrency Level: 100 Time taken for tests: 39.862 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 66341000 bytes HTML transferred: 66030000 bytes Requests per second: 25.09 [#/sec] (mean) Time per request: 3986.222 [ms] (mean) Time per request: 39.862 [ms] (mean, across all concurrent requests) Transfer rate: 1625.25 [Kbytes/sec] received
$ ab -n 1000 -c 100 http://dolls.tokyo/
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>

中略

Server Software:        Apache
Server Hostname:        dolls.tokyo
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES256-GCM-SHA384,2048,256
Server Temp Key:        X25519 253 bits
TLS Server Name:        dolls.tokyo

Document Path:          /
Document Length:        66030 bytes

Concurrency Level:      100
Time taken for tests:   39.862 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      66341000 bytes
HTML transferred:       66030000 bytes
Requests per second:    25.09 [#/sec] (mean)
Time per request:       3986.222 [ms] (mean)
Time per request:       39.862 [ms] (mean, across all concurrent requests)
Transfer rate:          1625.25 [Kbytes/sec] received

Requests per second:が25を超えました。
同じコマンドでテストした前回は18でした。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ab -n 1000 -c 100 http://dolls.tokyo/
Concurrency Level: 100
Time taken for tests: 54.027 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 41122000 bytes
HTML transferred: 40811000 bytes
Requests per second: 18.51 [#/sec] (mean)
Time per request: 5402.658 [ms] (mean)
Time per request: 54.027 [ms] (mean, across all concurrent requests)
Transfer rate: 743.30 [Kbytes/sec] received
$ab -n 1000 -c 100 http://dolls.tokyo/ Concurrency Level: 100 Time taken for tests: 54.027 seconds Complete requests: 1000 Failed requests: 0 Total transferred: 41122000 bytes HTML transferred: 40811000 bytes Requests per second: 18.51 [#/sec] (mean) Time per request: 5402.658 [ms] (mean) Time per request: 54.027 [ms] (mean, across all concurrent requests) Transfer rate: 743.30 [Kbytes/sec] received
$ab -n 1000 -c 100 http://dolls.tokyo/
Concurrency Level: 100
Time taken for tests: 54.027 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 41122000 bytes
HTML transferred: 40811000 bytes
Requests per second: 18.51 [#/sec] (mean)
Time per request: 5402.658 [ms] (mean)
Time per request: 54.027 [ms] (mean, across all concurrent requests)
Transfer rate: 743.30 [Kbytes/sec] received

他にも処理時間や転送レートなど各数値が向上していることがわかります。

トラブルからの開始でしたが、結果的にメリットの多い引っ越しでした。
速度もアップしたし、懸案のバージョンアップも完了。
なにより次にバージョンアップを迫られた時の、手順を把握できた事が大きい。

ベースラインを記録

2021/08/15 追記

安定化状態でのベースラインを記録しておきます。

AWS CPUメトリクス

top -c

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
top - 00:59:27 up 13 days, 18:41, 1 user, load average: 0.10, 0.08, 0.03
Tasks: 79 total, 1 running, 78 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 478.9 total, 35.0 free, 263.2 used, 180.6 buff/cache
MiB Swap: 634.8 total, 99.3 free, 535.5 used. 151.1 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
25438 bitnami 20 0 16620 2208 1108 S 0.3 0.5 0:00.04 sshd: bitnami@pts/0
1 root 20 0 170560 2484 1260 S 0.0 0.5 0:13.67 /lib/systemd/system+
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd]
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_gp]
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_par_gp]
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kworker/0:0H-kbloc+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [mm_percpu_wq]
9 root 20 0 0 0 0 S 0.0 0.0 0:09.03 [ksoftirqd/0]
10 root 20 0 0 0 0 I 0.0 0.0 0:36.48 [rcu_sched]
11 root 20 0 0 0 0 I 0.0 0.0 0:00.00 [rcu_bh]
12 root rt 0 0 0 0 S 0.0 0.0 0:02.20 [migration/0]
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [cpuhp/0]
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kdevtmpfs]
16 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [netns]
17 root 20 0 0 0 0 S 0.0 0.0 0:00.09 [kauditd]
18 root 20 0 0 0 0 S 0.0 0.0 0:00.48 [khungtaskd]
19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [oom_reaper]
20 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [writeback]
21 root 20 0 0 0 0 S 0.0 0.0 0:01.64 [kcompactd0]
22 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd]
23 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [crypto]
24 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kintegrityd]
25 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kblockd]
26 root rt 0 0 0 0 S 0.0 0.0 0:00.00 [watchdogd]
top - 00:59:27 up 13 days, 18:41, 1 user, load average: 0.10, 0.08, 0.03 Tasks: 79 total, 1 running, 78 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 478.9 total, 35.0 free, 263.2 used, 180.6 buff/cache MiB Swap: 634.8 total, 99.3 free, 535.5 used. 151.1 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 25438 bitnami 20 0 16620 2208 1108 S 0.3 0.5 0:00.04 sshd: bitnami@pts/0 1 root 20 0 170560 2484 1260 S 0.0 0.5 0:13.67 /lib/systemd/system+ 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] 3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_gp] 4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [rcu_par_gp] 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kworker/0:0H-kbloc+ 8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [mm_percpu_wq] 9 root 20 0 0 0 0 S 0.0 0.0 0:09.03 [ksoftirqd/0] 10 root 20 0 0 0 0 I 0.0 0.0 0:36.48 [rcu_sched] 11 root 20 0 0 0 0 I 0.0 0.0 0:00.00 [rcu_bh] 12 root rt 0 0 0 0 S 0.0 0.0 0:02.20 [migration/0] 14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [cpuhp/0] 15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kdevtmpfs] 16 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [netns] 17 root 20 0 0 0 0 S 0.0 0.0 0:00.09 [kauditd] 18 root 20 0 0 0 0 S 0.0 0.0 0:00.48 [khungtaskd] 19 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [oom_reaper] 20 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [writeback] 21 root 20 0 0 0 0 S 0.0 0.0 0:01.64 [kcompactd0] 22 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] 23 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [crypto] 24 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kintegrityd] 25 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 [kblockd] 26 root rt 0 0 0 0 S 0.0 0.0 0:00.00 [watchdogd]
top - 00:59:27 up 13 days, 18:41,  1 user,  load average: 0.10, 0.08, 0.03
Tasks:  79 total,   1 running,  78 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    478.9 total,     35.0 free,    263.2 used,    180.6 buff/cache
MiB Swap:    634.8 total,     99.3 free,    535.5 used.    151.1 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND              
25438 bitnami   20   0   16620   2208   1108 S   0.3   0.5   0:00.04 sshd: bitnami@pts/0  
    1 root      20   0  170560   2484   1260 S   0.0   0.5   0:13.67 /lib/systemd/system+ 
    2 root      20   0       0      0      0 S   0.0   0.0   0:00.00 [kthreadd]           
    3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [rcu_gp]             
    4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [rcu_par_gp]         
    6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [kworker/0:0H-kbloc+ 
    8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [mm_percpu_wq]       
    9 root      20   0       0      0      0 S   0.0   0.0   0:09.03 [ksoftirqd/0]        
   10 root      20   0       0      0      0 I   0.0   0.0   0:36.48 [rcu_sched]          
   11 root      20   0       0      0      0 I   0.0   0.0   0:00.00 [rcu_bh]             
   12 root      rt   0       0      0      0 S   0.0   0.0   0:02.20 [migration/0]        
   14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 [cpuhp/0]            
   15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 [kdevtmpfs]          
   16 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [netns]              
   17 root      20   0       0      0      0 S   0.0   0.0   0:00.09 [kauditd]            
   18 root      20   0       0      0      0 S   0.0   0.0   0:00.48 [khungtaskd]         
   19 root      20   0       0      0      0 S   0.0   0.0   0:00.00 [oom_reaper]         
   20 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [writeback]          
   21 root      20   0       0      0      0 S   0.0   0.0   0:01.64 [kcompactd0]         
   22 root      25   5       0      0      0 S   0.0   0.0   0:00.00 [ksmd]               
   23 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [crypto]             
   24 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [kintegrityd]        
   25 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 [kblockd]            
   26 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 [watchdogd]

pidstat

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ pidstat
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)
01:09:48 AM UID PID %usr %system %guest %wait %CPU CPU Command
01:09:48 AM 0 1 0.00 0.00 0.00 0.00 0.00 0 systemd
01:09:48 AM 0 9 0.00 0.00 0.00 0.00 0.00 0 ksoftirqd/0
01:09:48 AM 0 10 0.00 0.00 0.00 0.03 0.00 0 rcu_sched
01:09:48 AM 0 12 0.00 0.00 0.00 0.00 0.00 0 migration/0
01:09:48 AM 0 17 0.00 0.00 0.00 0.00 0.00 0 kauditd
01:09:48 AM 0 18 0.00 0.00 0.00 0.00 0.00 0 khungtaskd
01:09:48 AM 0 21 0.00 0.00 0.00 0.00 0.00 0 kcompactd0
01:09:48 AM 0 29 0.00 0.04 0.00 0.01 0.04 0 kswapd0
01:09:48 AM 0 48 0.00 0.00 0.00 0.00 0.00 0 xenwatch
01:09:48 AM 0 205 0.00 0.00 0.00 0.00 0.00 0 kworker/0:1H-kb
lockd
01:09:48 AM 0 211 0.00 0.00 0.00 0.00 0.00 0 jbd2/xvda1-8
01:09:48 AM 0 346 0.00 0.00 0.00 0.01 0.00 0 haveged
01:09:48 AM 0 371 0.00 0.00 0.00 0.00 0.00 0 dhclient
01:09:48 AM 0 446 0.00 0.00 0.00 0.00 0.00 0 dhclient
01:09:48 AM 105 544 0.00 0.00 0.00 0.00 0.01 0 dbus-daemon
01:09:48 AM 0 562 0.00 0.00 0.00 0.00 0.00 0 systemd-logind
01:09:48 AM 106 566 0.00 0.00 0.00 0.00 0.00 0 chronyd
01:09:48 AM 0 579 0.00 0.00 0.00 0.00 0.00 0 cron
01:09:48 AM 0 598 0.00 0.00 0.00 0.00 0.00 0 atd
01:09:48 AM 0 604 0.01 0.00 0.00 0.00 0.01 0 unattended-upgr
01:09:48 AM 0 703 0.00 0.00 0.00 0.00 0.00 0 httpd.bin
01:09:48 AM 0 2986 0.00 0.00 0.00 0.00 0.00 0 gonit
01:09:48 AM 0 3025 0.00 0.00 0.00 0.00 0.00 0 sshd
01:09:48 AM 0 3808 0.00 0.00 0.00 0.00 0.00 0 systemd-udevd
01:09:48 AM 0 8214 0.00 0.00 0.00 0.00 0.00 0 systemd-journal
01:09:48 AM 0 9330 0.00 0.00 0.00 0.00 0.00 0 rsyslogd
01:09:48 AM 0 12642 0.00 0.00 0.00 0.00 0.00 0 kworker/u30:2-e
vents_unbound
01:09:48 AM 0 13782 0.00 0.00 0.00 0.00 0.00 0 polkitd
01:09:48 AM 1000 18735 0.00 0.00 0.00 0.00 0.00 0 systemd
01:09:48 AM 1001 21706 0.45 0.18 0.00 0.00 0.64 0 mysqld.bin
01:09:48 AM 0 21763 0.00 0.00 0.00 0.00 0.00 0 .php-fpm.bin
01:09:48 AM 0 22941 0.00 0.00 0.00 0.00 0.00 0 kworker/u30:0-e
vents_unbound
01:09:48 AM 1 24719 0.00 0.00 0.00 0.00 0.00 0 httpd.bin
01:09:48 AM 1 24787 0.00 0.00 0.00 0.00 0.00 0 httpd.bin
01:09:48 AM 1 24858 0.00 0.00 0.00 0.00 0.00 0 httpd.bin
01:09:48 AM 0 25021 0.00 0.00 0.00 0.00 0.00 0 kworker/0:0-mm_
percpu_wq
01:09:48 AM 0 25432 0.00 0.00 0.00 0.00 0.00 0 sshd
01:09:48 AM 1000 25438 0.00 0.00 0.00 0.00 0.00 0 sshd
01:09:48 AM 1000 25448 0.00 0.00 0.00 0.00 0.00 0 bash
01:09:48 AM 1 25545 0.00 0.00 0.00 0.00 0.00 0 .php-fpm.bin
$ pidstat Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU) 01:09:48 AM UID PID %usr %system %guest %wait %CPU CPU Command 01:09:48 AM 0 1 0.00 0.00 0.00 0.00 0.00 0 systemd 01:09:48 AM 0 9 0.00 0.00 0.00 0.00 0.00 0 ksoftirqd/0 01:09:48 AM 0 10 0.00 0.00 0.00 0.03 0.00 0 rcu_sched 01:09:48 AM 0 12 0.00 0.00 0.00 0.00 0.00 0 migration/0 01:09:48 AM 0 17 0.00 0.00 0.00 0.00 0.00 0 kauditd 01:09:48 AM 0 18 0.00 0.00 0.00 0.00 0.00 0 khungtaskd 01:09:48 AM 0 21 0.00 0.00 0.00 0.00 0.00 0 kcompactd0 01:09:48 AM 0 29 0.00 0.04 0.00 0.01 0.04 0 kswapd0 01:09:48 AM 0 48 0.00 0.00 0.00 0.00 0.00 0 xenwatch 01:09:48 AM 0 205 0.00 0.00 0.00 0.00 0.00 0 kworker/0:1H-kb lockd 01:09:48 AM 0 211 0.00 0.00 0.00 0.00 0.00 0 jbd2/xvda1-8 01:09:48 AM 0 346 0.00 0.00 0.00 0.01 0.00 0 haveged 01:09:48 AM 0 371 0.00 0.00 0.00 0.00 0.00 0 dhclient 01:09:48 AM 0 446 0.00 0.00 0.00 0.00 0.00 0 dhclient 01:09:48 AM 105 544 0.00 0.00 0.00 0.00 0.01 0 dbus-daemon 01:09:48 AM 0 562 0.00 0.00 0.00 0.00 0.00 0 systemd-logind 01:09:48 AM 106 566 0.00 0.00 0.00 0.00 0.00 0 chronyd 01:09:48 AM 0 579 0.00 0.00 0.00 0.00 0.00 0 cron 01:09:48 AM 0 598 0.00 0.00 0.00 0.00 0.00 0 atd 01:09:48 AM 0 604 0.01 0.00 0.00 0.00 0.01 0 unattended-upgr 01:09:48 AM 0 703 0.00 0.00 0.00 0.00 0.00 0 httpd.bin 01:09:48 AM 0 2986 0.00 0.00 0.00 0.00 0.00 0 gonit 01:09:48 AM 0 3025 0.00 0.00 0.00 0.00 0.00 0 sshd 01:09:48 AM 0 3808 0.00 0.00 0.00 0.00 0.00 0 systemd-udevd 01:09:48 AM 0 8214 0.00 0.00 0.00 0.00 0.00 0 systemd-journal 01:09:48 AM 0 9330 0.00 0.00 0.00 0.00 0.00 0 rsyslogd 01:09:48 AM 0 12642 0.00 0.00 0.00 0.00 0.00 0 kworker/u30:2-e vents_unbound 01:09:48 AM 0 13782 0.00 0.00 0.00 0.00 0.00 0 polkitd 01:09:48 AM 1000 18735 0.00 0.00 0.00 0.00 0.00 0 systemd 01:09:48 AM 1001 21706 0.45 0.18 0.00 0.00 0.64 0 mysqld.bin 01:09:48 AM 0 21763 0.00 0.00 0.00 0.00 0.00 0 .php-fpm.bin 01:09:48 AM 0 22941 0.00 0.00 0.00 0.00 0.00 0 kworker/u30:0-e vents_unbound 01:09:48 AM 1 24719 0.00 0.00 0.00 0.00 0.00 0 httpd.bin 01:09:48 AM 1 24787 0.00 0.00 0.00 0.00 0.00 0 httpd.bin 01:09:48 AM 1 24858 0.00 0.00 0.00 0.00 0.00 0 httpd.bin 01:09:48 AM 0 25021 0.00 0.00 0.00 0.00 0.00 0 kworker/0:0-mm_ percpu_wq 01:09:48 AM 0 25432 0.00 0.00 0.00 0.00 0.00 0 sshd 01:09:48 AM 1000 25438 0.00 0.00 0.00 0.00 0.00 0 sshd 01:09:48 AM 1000 25448 0.00 0.00 0.00 0.00 0.00 0 bash 01:09:48 AM 1 25545 0.00 0.00 0.00 0.00 0.00 0 .php-fpm.bin
$ pidstat
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)

01:09:48 AM   UID       PID    %usr %system  %guest   %wait    %CPU   CPU  Command
01:09:48 AM     0         1    0.00    0.00    0.00    0.00    0.00     0  systemd
01:09:48 AM     0         9    0.00    0.00    0.00    0.00    0.00     0  ksoftirqd/0
01:09:48 AM     0        10    0.00    0.00    0.00    0.03    0.00     0  rcu_sched
01:09:48 AM     0        12    0.00    0.00    0.00    0.00    0.00     0  migration/0
01:09:48 AM     0        17    0.00    0.00    0.00    0.00    0.00     0  kauditd
01:09:48 AM     0        18    0.00    0.00    0.00    0.00    0.00     0  khungtaskd
01:09:48 AM     0        21    0.00    0.00    0.00    0.00    0.00     0  kcompactd0
01:09:48 AM     0        29    0.00    0.04    0.00    0.01    0.04     0  kswapd0
01:09:48 AM     0        48    0.00    0.00    0.00    0.00    0.00     0  xenwatch
01:09:48 AM     0       205    0.00    0.00    0.00    0.00    0.00     0  kworker/0:1H-kb
lockd
01:09:48 AM     0       211    0.00    0.00    0.00    0.00    0.00     0  jbd2/xvda1-8
01:09:48 AM     0       346    0.00    0.00    0.00    0.01    0.00     0  haveged
01:09:48 AM     0       371    0.00    0.00    0.00    0.00    0.00     0  dhclient
01:09:48 AM     0       446    0.00    0.00    0.00    0.00    0.00     0  dhclient
01:09:48 AM   105       544    0.00    0.00    0.00    0.00    0.01     0  dbus-daemon
01:09:48 AM     0       562    0.00    0.00    0.00    0.00    0.00     0  systemd-logind
01:09:48 AM   106       566    0.00    0.00    0.00    0.00    0.00     0  chronyd
01:09:48 AM     0       579    0.00    0.00    0.00    0.00    0.00     0  cron
01:09:48 AM     0       598    0.00    0.00    0.00    0.00    0.00     0  atd
01:09:48 AM     0       604    0.01    0.00    0.00    0.00    0.01     0  unattended-upgr
01:09:48 AM     0       703    0.00    0.00    0.00    0.00    0.00     0  httpd.bin
01:09:48 AM     0      2986    0.00    0.00    0.00    0.00    0.00     0  gonit
01:09:48 AM     0      3025    0.00    0.00    0.00    0.00    0.00     0  sshd
01:09:48 AM     0      3808    0.00    0.00    0.00    0.00    0.00     0  systemd-udevd
01:09:48 AM     0      8214    0.00    0.00    0.00    0.00    0.00     0  systemd-journal
01:09:48 AM     0      9330    0.00    0.00    0.00    0.00    0.00     0  rsyslogd
01:09:48 AM     0     12642    0.00    0.00    0.00    0.00    0.00     0  kworker/u30:2-e
vents_unbound
01:09:48 AM     0     13782    0.00    0.00    0.00    0.00    0.00     0  polkitd
01:09:48 AM  1000     18735    0.00    0.00    0.00    0.00    0.00     0  systemd
01:09:48 AM  1001     21706    0.45    0.18    0.00    0.00    0.64     0  mysqld.bin
01:09:48 AM     0     21763    0.00    0.00    0.00    0.00    0.00     0  .php-fpm.bin
01:09:48 AM     0     22941    0.00    0.00    0.00    0.00    0.00     0  kworker/u30:0-e
vents_unbound
01:09:48 AM     1     24719    0.00    0.00    0.00    0.00    0.00     0  httpd.bin
01:09:48 AM     1     24787    0.00    0.00    0.00    0.00    0.00     0  httpd.bin
01:09:48 AM     1     24858    0.00    0.00    0.00    0.00    0.00     0  httpd.bin
01:09:48 AM     0     25021    0.00    0.00    0.00    0.00    0.00     0  kworker/0:0-mm_
percpu_wq
01:09:48 AM     0     25432    0.00    0.00    0.00    0.00    0.00     0  sshd
01:09:48 AM  1000     25438    0.00    0.00    0.00    0.00    0.00     0  sshd
01:09:48 AM  1000     25448    0.00    0.00    0.00    0.00    0.00     0  bash
01:09:48 AM     1     25545    0.00    0.00    0.00    0.00    0.00     0  .php-fpm.bin

各確認コマンド

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ free
total used free shared buff/cache available
Mem: 490368 277880 19400 53440 193088 146280
Swap: 649996 545232 104764
$ iostat -x
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
1.36 0.00 0.40 0.89 0.02 97.33
Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await
w_await aqu-sz rareq-sz wareq-sz svctm %util
xvda 38.22 24.29 549.03 261.38 0.13 3.21 0.33 11.68 0.75
1.67 1.06 14.37 10.76 16.00 100.00
$ sar
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)
01:22:15 AM LINUX RESTART(1 CPU)
01:23:01 AM CPU %user %nice %system %iowait %steal %idle
01:24:01 AM all 0.92 0.00 0.32 0.55 0.02 98.20
01:25:01 AM all 3.66 0.00 1.04 2.51 0.08 92.72
01:26:01 AM all 0.47 0.00 0.27 0.25 0.02 99.00
01:27:01 AM all 2.09 0.00 0.65 1.07 0.05 96.14
01:28:01 AM all 0.55 0.00 0.17 0.53 0.03 98.71
01:29:01 AM all 1.20 0.00 0.45 0.52 0.02 97.81
01:30:01 AM all 0.48 0.00 0.18 0.42 0.03 98.88
01:31:01 AM all 2.24 0.00 0.63 0.79 0.00 96.34
01:32:01 AM all 0.72 0.00 0.38 1.60 0.03 97.26
01:33:01 AM all 2.20 0.00 0.89 2.46 0.10 94.35
01:34:01 AM all 0.07 0.00 0.08 0.03 0.02 99.80
01:35:01 AM all 1.67 0.00 0.60 2.24 0.05 95.44
01:36:01 AM all 2.39 0.00 0.72 1.89 0.07 94.94
01:37:01 AM all 1.95 0.00 0.62 0.94 0.02 96.48
01:38:01 AM all 0.20 0.00 0.12 0.12 0.02 99.55
Average: all 1.39 0.00 0.47 1.06 0.04 97.04
$ free total used free shared buff/cache available Mem: 490368 277880 19400 53440 193088 146280 Swap: 649996 545232 104764 $ iostat -x Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.36 0.00 0.40 0.89 0.02 97.33 Device r/s w/s rkB/s wkB/s rrqm/s wrqm/s %rrqm %wrqm r_await w_await aqu-sz rareq-sz wareq-sz svctm %util xvda 38.22 24.29 549.03 261.38 0.13 3.21 0.33 11.68 0.75 1.67 1.06 14.37 10.76 16.00 100.00 $ sar Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU) 01:22:15 AM LINUX RESTART(1 CPU) 01:23:01 AM CPU %user %nice %system %iowait %steal %idle 01:24:01 AM all 0.92 0.00 0.32 0.55 0.02 98.20 01:25:01 AM all 3.66 0.00 1.04 2.51 0.08 92.72 01:26:01 AM all 0.47 0.00 0.27 0.25 0.02 99.00 01:27:01 AM all 2.09 0.00 0.65 1.07 0.05 96.14 01:28:01 AM all 0.55 0.00 0.17 0.53 0.03 98.71 01:29:01 AM all 1.20 0.00 0.45 0.52 0.02 97.81 01:30:01 AM all 0.48 0.00 0.18 0.42 0.03 98.88 01:31:01 AM all 2.24 0.00 0.63 0.79 0.00 96.34 01:32:01 AM all 0.72 0.00 0.38 1.60 0.03 97.26 01:33:01 AM all 2.20 0.00 0.89 2.46 0.10 94.35 01:34:01 AM all 0.07 0.00 0.08 0.03 0.02 99.80 01:35:01 AM all 1.67 0.00 0.60 2.24 0.05 95.44 01:36:01 AM all 2.39 0.00 0.72 1.89 0.07 94.94 01:37:01 AM all 1.95 0.00 0.62 0.94 0.02 96.48 01:38:01 AM all 0.20 0.00 0.12 0.12 0.02 99.55 Average: all 1.39 0.00 0.47 1.06 0.04 97.04
$ free
              total        used        free      shared  buff/cache   available
Mem:         490368      277880       19400       53440      193088      146280
Swap:        649996      545232      104764

$ iostat -x
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.36    0.00    0.40    0.89    0.02   97.33

Device            r/s     w/s     rkB/s     wkB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await 
w_await aqu-sz rareq-sz wareq-sz  svctm  %util
xvda            38.22   24.29    549.03    261.38     0.13     3.21   0.33  11.68    0.75 
   1.67   1.06    14.37    10.76  16.00 100.00

$ sar
Linux 4.19.0-14-cloud-amd64 (ip-172-26-0-28) 08/15/2021 _x86_64_(1 CPU)

01:22:15 AM  LINUX RESTART(1 CPU)

01:23:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
01:24:01 AM     all      0.92      0.00      0.32      0.55      0.02     98.20
01:25:01 AM     all      3.66      0.00      1.04      2.51      0.08     92.72
01:26:01 AM     all      0.47      0.00      0.27      0.25      0.02     99.00
01:27:01 AM     all      2.09      0.00      0.65      1.07      0.05     96.14
01:28:01 AM     all      0.55      0.00      0.17      0.53      0.03     98.71
01:29:01 AM     all      1.20      0.00      0.45      0.52      0.02     97.81
01:30:01 AM     all      0.48      0.00      0.18      0.42      0.03     98.88
01:31:01 AM     all      2.24      0.00      0.63      0.79      0.00     96.34
01:32:01 AM     all      0.72      0.00      0.38      1.60      0.03     97.26
01:33:01 AM     all      2.20      0.00      0.89      2.46      0.10     94.35
01:34:01 AM     all      0.07      0.00      0.08      0.03      0.02     99.80
01:35:01 AM     all      1.67      0.00      0.60      2.24      0.05     95.44
01:36:01 AM     all      2.39      0.00      0.72      1.89      0.07     94.94
01:37:01 AM     all      1.95      0.00      0.62      0.94      0.02     96.48
01:38:01 AM     all      0.20      0.00      0.12      0.12      0.02     99.55
Average:        all      1.39      0.00      0.47      1.06      0.04     97.04

 

2 thoughts on “0

  1. Jetpack 接続トークンが無効ですで一生困ってたので助かりました感謝

コメントを残す