PostgreSQL でレプリケーション

CentOS 7で運用しているPostgreSQLでレプリケーションをおこないました。CentOS 7なので最新ではないので需要は少ないと思いますが、その際の手順をまとめておきます
root権限でrsyncを実行する

webディレクトリがあるディレクトリ等でrysncコマンドを実行すると所有者権限でコピーできないディレクトリやファイルがあったりします。同一サーバー内だとroot でrsyn ...
mysqld_multiで複数のインスタンスを起動する【MariaDB】

MariaDBで複数のMySQLのインスタンスを起動するには「mysqld_multi」を利用するとできます。
検証したサーバーは、少し古くCentOS 7系で、Ma ...
lsコマンドでタイムスタンプ書式で表示する

lsコマンドで、「ls -l」 と入力するとファイル・ディレクトリのタイムスタンプが表示されますが、更新された月の表示が英語の略式でわかりにくかったり、昔のファイルの場合は時間が表示されなかったりするので、「2021/10/26 10 ...
Let’s Encryptのルート CA期限切れでPHP(file_get_contents)でエラー

10月1日になると、PHPのfile_get_contentsで、SSL通信するとエラーがでて処理ができなくなりました。PHPで指定しているUR ...
PostgreSQL(psql)の接続と切断

普段はMySQLを使用しているので、PostgreSQLとはDBへの接続方法やDBの選択や終了などを違うので簡単にまとめてみました
psqlへの接続PostgreSQLへの ...
PostgreSQLで、データベースの一覧を確認する

久しぶりにPostgreSQLを触って、データベース一覧を表示しようと思ったら、以下のようにエラーになりました。
MySQLとコマンドが違うので、「show databases」と叩くと、「ERROR: unrecognize ...
grep で単語単位で一致した行を抽出する方法

grepで検索する単語で一致した行を抽出する時に、以下のようなテキストファイルがある場合、「192.168.0.1」でgrepすると「192.168.0.1、192.168.0.101」等の行も抽出されます
$ cat test ...grep で完全一致した行を抽出する方法

grepで検索文字と完全一致した行を表示するには「x」のオプションを利用します。
manページで確認すると、以下のような説明になります
-x, –line-regexpパターンが行全体とぴったりマッ ...
WordPressでPHPのバージョンアップ後、エラーで見れなくなった場合

PHPを7.3から7.4や8.0にバージョンアップしたら、Wordpressがあるコンテンツが「このサイトで重大なエラーが発生しました」と表示されて、サイトが閲覧 ...
phpで「extension」の場所を確認する方法

php.iniで拡張パッケージを指定するディレクトリである「extension_dir」設定ですが、「extension」の場所がわからずに少し困りましたが、「phpinfo」関数で確認できます。
WEBで「phpinfo ...
Nextcloudでアップデート後にメンテナンス中のままになる

Nextcloudのサーバー側がをアップデートが公開されたので、アップデートをおこなうと下記のようにメンテナンスのままで、WEB画面にアクセスできなくなりました
アップデートの時にエラーもなかったので、5分くらい待ってもメ ...
LVMで、「/home」を削除して「/」の領域を拡張したい

OSインストール時に、DISKのパーティション設定の時にデフォルトのままでインストールしてしまい、下記のように「/」の容量が小さくて、「/home」の容量がすごく大きくなった場合、「/home」を領域を削除して「/」に全て領域を使用し ...
CPUコア毎のCPU使用率を確認する[mpstat]

CPUのコア毎のCPU使用率を確認するには、「top」コマンドで「1」を入力すれば表示できます
参考記事:topコマンドでコア単位でCPU使用率を確認する
今回はTOPコ ...
特定のユーザーでsudoを利用できるようにする

特定のユーザーで「sudo」コマンドを利用できるようにします。
sudoを許可していないユーザーで「sudo su -」のコマンドを利用すると以下のように「xxx is ...