–update t_datanum set reg_dt = now() where reg_dt < now() – interval ‘1 hour’;
update
t_datanum
set
— reg_dt = (case when reg_dt < now() – interval ‘1 hour’ then date_trunc(‘hour’, now()) else reg_dt end),
reg_dt = (case when reg_dt < now() – interval ‘1 hour’ then now() else reg_dt end),
count = (case when reg_dt < now() – interval ‘1 hour’ then 0 else count + 1 end)
;

–update t_datanum set count = count + 1 where reg_dt >= now() – interval ‘1 hour’;
select * from t_datanum ;

yum install unzip

cd /usr/local/src/
curl “https://s3.amazonaws.com/aws-cli/awscli-bundle.zip” -o “awscli-bundle.zip”
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
/usr/local/bin/aws –version

/usr/local/bin/aws configure
/usr/local/bin/aws deploy register –instance-name centos7 –iam-user-arn arn:aws:iam::1234567890:user/deploy–tags Key=deploy,Value=true –region ap-northeast-1

mkdir -p /etc/codedeploy-agent/conf
vi /etc/codedeploy-agent/conf/codedeploy.onpremises.yml

/usr/local/bin/aws deploy install –override-config –config-file /etc/codedeploy-agent/conf/codedeploy.onpremises.yml –region ap-northeast-1

 

Only Ubuntu Server, Red Hat Enterprise Linux Server and Windows Server operating systems are supported.

 

centos7 もamazon linuxも

★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

★backend vsftpdサーバ×2

vi /etc/vsftpd/vsftpd.conf

pasv_enable=YES
pasv_min_port=60000
pasv_max_port=60001
pasv_address=lb.x.x.x

 

★frontend nginxサーバ

vi nginx.conf

stream {
#FTP
upstream ftp {
hash $remote_addr;
server vsftpd.nilesflow.net:21 weight=5 max_fails=3 fail_timeout=30s;
server aws-default.nilesflow.net:21 weight=5 max_fails=3 fail_timeout=30s;
# server pure-ftpd.nilesflow.net:10021 weight=5 max_fails=3 fail_timeout=30s;
}

server {
listen 20021;
proxy_connect_timeout 1s;
# proxy_timeout 3s;
proxy_pass ftp;
}

#FTP data
upstream ftpdata-v1 {
hash $remote_addr;
server vsftpd.nilesflow.net:60000 weight=5 max_fails=3 fail_timeout=30s;
server aws-default.nilesflow.net:60000 weight=5 max_fails=3 fail_timeout=30s;
}
upstream ftpdata-v2 {
server vsftpd.nilesflow.net:60001 weight=5 max_fails=3 fail_timeout=30s;
server aws-default.nilesflow.net:60001 weight=5 max_fails=3 fail_timeout=30s;
}

# vsftpd
server {
listen 60000;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-v1;
}
server {
listen 60001;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-v2;
}

 

★どこかのサーバから

ftp lb.nilesflow.net 20021

 

★補足

pasv_address= ドメイン名ではなくIPアドレス

vi /etc/vsftpd/vsftpd.conf

pasv_enable=YES
pasv_min_port=60000
pasv_max_port=60001
pasv_address=x.x.x.x

vi /etc/pure-ftpd/pure-ftpd.conf

Bind                            z.z.z.z,10021

PassivePortRange          60010 60011

ForcePassiveIP x.x.x.x

 

vi nginx.conf

stream {
#FTP
upstream ftp {
hash $remote_addr;
server z.z.z.z:21 weight=5 max_fails=3 fail_timeout=30s; #v
server z.z.z.z:10021 weight=5 max_fails=3 fail_timeout=30s; #p
}

server {
listen 20021;
proxy_connect_timeout 1s;
# proxy_timeout 3s;
proxy_pass ftp;
}

#FTP data
upstream ftpdata-v1 {
server z.z.z.z:60000 weight=5 max_fails=3 fail_timeout=30s;
}
upstream ftpdata-v2 {
server z.z.z.z:60001 weight=5 max_fails=3 fail_timeout=30s;
}
upstream ftpdata-p1 {
server z.z.z.z:60010 weight=5 max_fails=3 fail_timeout=30s;
}
upstream ftpdata-p2 {
server z.z.z.z:60011 weight=5 max_fails=3 fail_timeout=30s;
}

# vsftpd
server {
listen 60000;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-v1;
}
server {
listen 60001;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-v2;
}

# pure-ftpd
server {
listen 60010;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-p1;
}
server {
listen 60011;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass ftpdata-p2;
}

vi /etc/rsyslog.conf

 

http://unixservermemo.web.fc2.com/sv/pure-log.htm

yum install postfix

 

★postfixの設定

vi /etc/postfix/main.cf

myhostname = mail-dev.nilesflow.net

mydomain = nilesflow.net

myorigin = mail-dev.nilesflow.net

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

local_recipient_maps =

mynetworks = 127.0.0.0/8, 192.168.1.0/24, x.x.x.x/32, y.y.y.y/32

relay_domains = $mydestination

virtual_alias_domains = mail-dev.nilesflow.net
virtual_alias_maps = hash:/etc/postfix/virtual

#home_mailbox = Mailbox
#home_mailbox = Maildir/

sendmail_path = /usr/sbin/sendmail

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_application_name = smtpd
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
#smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_destination
~

★ヘッダ記録

smtpd_sasl_authenticated_header = yes

 

★sasl2の設定

889 adduser postfix sasl
890 id postfix
894 gpasswd -a postfix sasl

 

929 vi /etc/sasl2/smtpd.conf

pwcheck_method: saslauthd
mech_list: plain login

変更なしかな

933 vi /etc/sysconfig/saslauthd

SOCKETDIR=/var/run/saslauthd

MECH=pam

# DAEMONOPTS=–user saslauth

FLAGS=

変更なしかな
934 saslpasswd2 -u mail-dev.nilesflow.net -c nilesflow
935 sasldblistusers2

 

★エイリアスの設定

995 vi /etc/aliases

nilesflow: “|/usr/local/php-5.6.12/bin/php -f /var/tmp/php/recvmail.php”
997 newaliases

 

★バーチャルエイリアスの設定

1040  vi /etc/postfix/virtual

@mail-dev.nilesflow.net nilesflow@mail-dev.nilesflow.net

 

1046  postmap hash:/etc/postfix/virtual

 

★サブミッション

vi /etc/postfix/master.cf

submission inet n – n – – smtpd
#-o smtpd_tls_security_level=encrypt
#-o smtpd_sasl_auth_enable=yes
#-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING

とりあえずSSLは使わないので

 

wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz

tar Jxvf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz

cp bin/wkhtmlto* /usr/local/bin/.

 

作ってみたが、文字が重なる・・・

http://dev.furoom.net/jsdoc3/jsdoc3/index.pdf

letter-spacingの問題っぽい。

オプションでも回避できなさそうな・・。残念。。

 

最新版入れてみる

1024 wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-centos6-amd64.rpm
1026 tar Jxvf wkhtmltox-0.13.0-alpha-7b36694_linux-centos6-amd64.rpm
1027 rpm -ivh wkhtmltox-0.13.0-alpha-7b36694_linux-centos6-amd64.rpm
1028 yum install icu
1029 yum install xorg-x11-fonts-Type1
1030 yum install xorg-x11-fonts-75dpi
1031 rpm -ivh wkhtmltox-0.13.0-alpha-7b36694_linux-centos6-amd64.rpm

 

動かない。

wkhtmltopdf index.html index.pdf
QXcbConnection: Could not connect to display
アボートしました

 

yum install xorg-x11-server-Xvfb

xvfb-run wkhtmltopdf index.html index.pdf

できれいに表示された!

 

でも複数表示できない。

export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb; xvfb-run wkhtmltopdf DomainSync.html DomainSync.js.ht
ml index.pdf
Error: This version of wkhtmltopdf is build against an unpatched version of QT, and does not support more then one input document.
Exit with code 1, due to unknown error.

 

stable 0.12.3 を使って、

letter-spacing を何とかするしかないのかも

 

–dpi 75 を着けると綺麗に表示された!

wkhtmltopdf –dpi 75 index.html  index.pdf

 

複数ファイル一気にかけようとするとエラーが発生する

wkhtmltopdf –dpi 75 *.html index.pdf
Loading pages (1/6)
Warning: Received createRequest signal on a disposed ResourceObject’s NetworkAccessManager. This might be an indication of an iframe taking too long to load.

 

–javascript-delay を付けると良いようだ

wkhtmltopdf –dpi 75 –javascript-delay 1000 *.html index.pdf

 

用紙幅が少なく感じるのは、

–page-size で調整すればよいのかな

http://stackoverflow.com/questions/6394905/wkhtmltopdf-what-paper-sizes-are-valid

 

A3 B3くらいがおさまりいい気がする

wkhtmltopdf –dpi 75 –javascript-delay 1000 –page-size B3 module-*.html index.pdf

 

–minimum-font-size

もあるけど、maxがない。文字大きくしたいのはそんなになさそう

 

jsdocの出力に対してかけたい。

.js.html はソースコードなのでとりあえず省く

index.htmlは最初におきたい

moduleは、moduleとclassで分けたい

wkhtmltopdf –dpi 75 –javascript-delay 1000 –page-size B3 index.html module*[^\.][^j][^s].html global.html index.pdf

 

classとmoduleがごちゃまぜなのでもう一息・・。

IAMユーザーでアクセスするには、

 

まず、アカウントから

https://console.aws.amazon.com/billing/home#/account

 

請求情報に対する IAM ユーザーアクセス

で、IAMアクセスのアクティブ化を行うこと。

 

そのあと、IAMポリシーをアタッチする。