update
cat /etc/redhat-release
yum update
history
shopt
vi /etc/profile.d/history.sh

HISTTIMEFORMAT='%F %T '
HISTSIZE=100000
HISTFILESIZE=100000
HISTIGNORE='history:pwd:ls:ls *:ll:w:top:df *'      # 保存しないコマンド
PROMPT_COMMAND='history -a; history -c; history -r' # 履歴のリアルタイム反映
timezone
ll /etc/localtime
timedatectl
date

timedatectl set-timezone Asia/Tokyo
apache
systemctl status apache
systemctl status httpd

yum install epel-release
yum install https://repo.ius.io/ius-release-el7.rpm

vi /etc/yum.repos.d/epel.repo
vi /etc/yum.repos.d/ius.repo
enabled=0

yum install centos-logos.noarch mailcap openldap-devel expat-devel libdb-devel openssl perl
yum --enablerepo=epel install nghttp2 brotli
yum install --disablerepo=base,extras,updates --enablerepo=ius httpd httpd-devel mod_ssl
yum list | grep httpd
systemctl start httpd
systemctl enable httpd.service

httpd -h
httpd -S
httpd -t -D DUMP_VHOSTS
httpd -t -D DUMP_RUN_CFG
httpd -v
httpd -V
httpd -l
httpd -t -D DUMP_MODULES
httpd -M
httpd -t -D DUMP_INCLUDES

ll /var/log/httpd/
less /etc/logrotate.conf
less /etc/logrotate.d/httpd

mkdir /var/www/html/php
chmod 777 /var/www/html/php/
ps aux | grep httpd
systemctl reload httpd
systemctl status httpd
systemctl restart httpd
systemctl status httpd
php5.4
yum info php
rpm -q --changelog php | grep CVE | less

yum install php
php -v
php -r 'phpinfo();'  | less
php modules
php -m | less
yum list --enablerepo=epel | grep php | less
yum install php-bcmath
php -m | less

vi bcmath.php
php bcmath.php
vi gettext.php
php gettext.php
vi gettext.php
php /var/www/html/php/phpinfo.php | less
yum list --enablerepo=epel | grep php | less
yum install php-pgsql
vi postgresql.php
php postgresql.php
mkdir php
vi *.php php/.
mv *.php php/.

php -m | less
yum install --enablerepo=epel php-pecl-redis
php -m | less
vi redis.php
php redis.php
php -m | less
postgresql13
yum install postgresql
yum install centos-release-scl
yum repolist -q
yum repolist all | less
vi /etc/yum.repos.d/CentOS-SCLo-scl.repo
vi /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo
↓
enabled=0

yum repolist all | less
yum repolist -q
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install postgresql13-contrib
yum install postgresql13-devel

yum repolist -q
yum install --enablerepo=epel postgresql13-devel
systemctl enable postgresql-13.service
ll /var/lib/pgsql/13/data/
PGSETUP_INITDB_OPTIONS="-E UTF8 --no-locale" /usr/pgsql-13/bin/postgresql-13-setup initdb
ll /var/lib/pgsql/13/data/
su - postgres

vi /var/lib/pgsql/.pgsql_profile
↓
PATH=/usr/pgsql-13/bin:$PATH
export PATH

which psql
psql -v
psql --version
/usr/pgsql-13/bin/psql --version
ls /bin/psql
ll /bin/psql
ll /etc/alternatives/pgsql-psql
pg_ctl
source .bash_profile

psql -l
psql -U postgres
createuser --login --pwprompt centos
createdb --owner=centos centos
systemctl start postgresql-13
ps aux | grep master
psql -U postgres
psql -l
redis6.2
yum list | grep redis
yum list --enablerepo=epel | grep redis
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
vi /etc/yum.repos.d/remi.repo
vi /etc/yum.repos.d/remi-safe.repo
↓
enabled=0

yum info --enablerepo=epel,remi redis
yum install --enablerepo=epel,remi redis
less /usr/lib/systemd/system/redis.service
systemctl status redis
systemctl enable redis
systemctl status redis
ps aux | grep redis
systemctl start redis
ps aux | grep redis
redis-cli ping
systemctl status redis

less /etc/logrotate.d/redis
pure-ftpd1.0.43
yum list | grep pure | less
yum list --enablerepo=epel | grep pure | less
cat /etc/redhat-release
yum update centos-release
→アップデート無し

yum repolist all | less
yum info --enablerepo=C7.0.1406-base pure-ftpd
yum search --enablerepo=C7.0.1406-base ftp
yum search ftp | less
yum install pure-ftpd
yum repolist all | less
yum list --enablerepo=epel | grep pure

cd /usr/local/src/
yum install wget
wget https://download.pureftpd.org/pub/pure-ftpd/releases/obsolete/pure-ftpd-1.0.43.tar.gz
tar xvzf pure-ftpd-1.0.43.tar.gz
cd pure-ftpd-1.0.43
yum install gcc
yum install openssl-devel
./configure --with-everything --with-paranoidmsg --without-capabilities --with-virtualchroot --with-uploadscript --with-tls
make
make install

https://gist.githubusercontent.com/zrong/c9588a17ccb15e75fdf7/raw/a24c563bfe0cdc238952ce24f560a8de42631c0f/pure-ftpd.sh

systemctl status pure-ftpd
cp configuration-file/pure-ftpd.conf /etc/.
cp configuration-file/pure-config.py /usr/local/bin/.
vi /etc/init.d/pure-ftpd
chmod 755 /etc/init.d/pure-ftpd
chmod 755 /usr/local/bin/pure-config.py
/etc/init.d/pure-ftpd start
ps aux | grep pure
yum install ftp
ftp localhost
java1.8.0
yum list | grep java | less
yum install java-1.8.0-openjdk
java -version
node.js14
yum list --enablerepo=epel | grep node | less
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -
vi /etc/yum.repos.d/nodesource-el7.repo
yum list | grep node
yum list | grep node | less
yum install nodejs
node -v
npm install forever -g
vi index.js
node index.js
forever start index.js
ll
vi node.js
mkdir node.js
mv index.js node.js/.

★slave のconf設定

vi /etc/redis/6379.conf

slaveof redis-master.nilesflow.net 6379

 

★redis-sentinel

wget http://download.redis.io/releases/redis-3.0.7.tar.gz

153 tar xvzf redis-3.0.7.tar.gz
154 cd redis-3.0.7
155 yum install -y gcc tcl
156 make
157 make install
158 mkdir /etc/redis
159 cp sentinel.conf /etc/redis/.
160 vi /etc/redis/sentinel.conf
161 rm /etc/redis/sentinel.conf
162 vi /etc/redis/sentinel.conf

 

163 vi /etc/hosts
167 redis-server /etc/redis/sentinel.conf –sentinel

177 cp sentinel.conf sentinel01.conf
178 vi sentinel01.conf
179 cp sentinel01.conf sentinel02.conf
180 cp sentinel01.conf sentinel03.conf
181 vi sentinel02.conf
182 vi sentinel03.conf
184 redis-server /etc/redis/sentinel01.conf –sentinel &
185 redis-server /etc/redis/sentinel02.conf –sentinel &
187 redis-server /etc/redis/sentinel03.conf –sentinel &

 

★materを落としてみる

standby→master

 

 

改めて

yum install gcc

make distclean

# 以下が残る

make

make install

 

http://redis.io/topics/quickstart

[root@ip-172-31-20-29 redis-3.0.7]# mkdir /etc/redis
[root@ip-172-31-20-29 redis-3.0.7]# mkdir /var/redis

[root@ip-172-31-20-29 redis-3.0.7]# mkdir /var/redis/6379
[root@ip-172-31-20-29 redis-3.0.7]# cp utils/redis_init_script /etc/init.d/redis_6379
[root@ip-172-31-20-29 redis-3.0.7]# cp redis.conf /etc/redis/6379.conf
[root@ip-172-31-20-29 redis-3.0.7]# vi /etc/redis/6379.conf

  • Set daemonize to yes (by default it is set to no).
  • Set the pidfile to /var/run/redis_6379.pid (modify the port if needed).
  • Change the port accordingly. In our example it is not needed as the default port is already 6379.
  • Set your preferred loglevel.
  • Set the logfile to /var/log/redis_6379.log
  • Set the dir to /var/redis/6379 (very important step!

[root@ip-172-31-20-29 redis-3.0.7]# /etc/init.d/redis_6379 start

 

★自動起動

# chkconfig: – 85 15
# description: redis-server
# processname: redis

chkconfig redis_6379 on

php.ini

session.save_path = “tcp://127.0.0.1:6379,tcp://127.0.0.1:6380”

これだと、ラウンドロビンっぽく順にアクセスするので、障害対応にはならない。

 

アプリ側で指定するか、redis sentinel 使うか、仮想IP使うか・・。

1. php phpredis

2. php predis

3. php predis-async

4. node.js redis

 

publish → subscribe までの時間

phpredis クライアントから26Mのファイル送信

クライアントpublish 0.3sec

1. 0.2sec

2. 0.5sec

3. 40sec ? 遅すぎ?

4. 4sec

 

ちなみにpublishにかかる時間

1. 0.3sec

2. 0.3sec

3. 35sec ? 遅すぎ?

4. 0.3sec

 

※上記複数クライアントを接続していたため、クライアント数を減らすと多少早くなる

 

——–

pubsub

お互いにsubscribe

subscribeを受けたら、publish

10000msg , 28byteデータ送信

 

1. node.js redis – node.js redis間

2. node.js redis – php phpredis間

2. node.js redis – php predis間

2. node.js redis – php predis-async間

 

結果

1.

pub完了 9041msg/sec

sub完了 7886msg/sec

2.

pub完了 12853msg/sec

sub完了 11834msg/sec

3.

pub完了 8319msg/sec

sub完了 6230msg/sec

4.

pub完了 8818msg/sec

sub完了 7342msg/sec

 

——–

ws-pubsub

wsからsend

お互いにsubscribe

subscribeを受けたら、publish

10000msg , 28byteデータ送信

 

1. node.js ws-client -> node.js ws-server & redis -> php phpredis

node.js ws-client <- node.js ws-server & redis <- php phpredis

 

ws-client 受信完了 1207msg/sec

ws-server pub完了 1216msg/sec

ws-server sub完了 1215msg/sec

phpredis pub完了 1216msg/sec

※redis-cli monitorで見ると、pubsub双方向は並列処理

※サーバは1cpu

predis-async を使った性能評価

同一サーバでpredis-asyncベースのクライアント/サーバ間でpub/sub

 

1.publish片方向

2.publish双方向

3.publish+lpush

※ appendonly yes 設定

 

1000msg送信を10回、その最大/最少

 

message size :28byte

1. 7405 – 8411 msg/sec

2. 4713 – 4951 msg/sec

3. 2697 – 3395 msg/sec

 

message size 4051byte

1. 6305 – 8042 msg/sec

2. 4217 – 4824 msg/sec

3. 2880 – 3129 msg/sec