-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
刘磊
committed
Sep 10, 2019
1 parent
08581dd
commit 26a2f32
Showing
8 changed files
with
185 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,15 +47,15 @@ usr/local/tomcat/apache-tomcat-7.0.54/logs/catalina.out { | |
|
||
daily | ||
|
||
copytruncate | ||
copytruncate | ||
|
||
compress | ||
|
||
notifempty | ||
|
||
missingok | ||
|
||
dateext | ||
dateext | ||
|
||
} | ||
|
||
|
@@ -188,6 +188,10 @@ iptables -I INPUT -s 180.162.0.0/16 -p tcp --dport 3306 -j ACCEPT | |
|
||
iptables -I INPUT -s 36.7.0.0/16 -p tcp --dport 3306 -j ACCEPT | ||
|
||
iptables-save | ||
|
||
iptables-restore | ||
|
||
//####����ͬ�� | ||
yum install xtrabackup | ||
|
||
|
@@ -263,6 +267,13 @@ yum install epel-release | |
//ʹ��openssl ����ת�� | ||
���openssl x509 -in api.transportjp.com.server.crt -out api.transportjp.com.server.cer -outform der | ||
|
||
//version 2 | ||
openssl genrsa -des3 -out dev.apistore.transportjp.com.key 1024 | ||
openssl req -new -subj /C=CN/ST=AnHui/L=HeFei/O=iTranswarp/OU=iTranswarp/CN=dev.apistore.transportjp.com -key dev.apistore.transportjp.com.key -out dev.apistore.transportjp.com.csr | ||
mv dev.apistore.transportjp.com.key dev.apistore.transportjp.com.origin.key | ||
openssl rsa -in dev.apistore.transportjp.com.origin.key -out dev.apistore.transportjp.com.key | ||
openssl x509 -req -days 3650 -in dev.apistore.transportjp.com.csr -signkey dev.apistore.transportjp.com.key -out dev.apistore.transportjp.com.crt | ||
|
||
<VirtualHost *:443> | ||
SSLEngine On | ||
SSLCertificateFile conf/ssl/server.crt | ||
|
@@ -274,6 +285,9 @@ yum install epel-release | |
//�����ƴ������� | ||
//https://help.aliyun.com/document_detail/25452.html?spm=5176.11065259.1996646101.searchclickresult.1db338f2uDGalg | ||
|
||
//����� | ||
lsblk -f | ||
|
||
������������ | ||
|
||
umount /dev/xvdb | ||
|
@@ -301,6 +315,11 @@ resize2fs /dev/xvdb # | |
|
||
mount /dev/xvdb /transimg | ||
|
||
# mount: you must specify the filesystem type | ||
mkfs.ext3 /dev/vdb ��ʽ�� | ||
|
||
##ѹ�� | ||
tar -cjf *.tar.bz2 Ҫ�����Ŀ¼���ļ� | ||
|
||
##��ѹ | ||
tar -jxvf xx.tar.bz2 | ||
|
@@ -315,5 +334,28 @@ find /path -mtime +30 -type f -name \*.zip -exec rm -f {} \; | |
###�����鿴 | ||
iftop -i eth1 -P | ||
|
||
|
||
rsync -avz --delete --exclude Application/Runtime/ [email protected]::mokuai /var/www/html/rigouwang/ --password-file=/etc/rsyncd.pwd | ||
[rsync] | ||
-a �������൱��-rlptgoD��-r �ǵݹ� -l �������ļ�����˼�ǿ��������ļ���-p ��ʾ�����ļ�ԭ��Ȩ�ޣ�-t �����ļ�ԭ��ʱ�䣻-g �����ļ�ԭ���û��飻-o �����ļ�ԭ��������-D �൱�ڿ��豸�ļ��� | ||
-z ����ʱѹ���� | ||
-P ������ȣ� | ||
-v ����ʱ�Ľ��ȵ���Ϣ����-P�е��ϵ | ||
rsync -avz --delete --exclude Application/Runtime/ [email protected]::mokuai /var/www/html/rigouwang/ --password-file=/etc/rsyncd.pwd | ||
rsync -r 172.16.10.5:/etc /tmp | ||
rsync -av ԴĿ¼ Ŀ��Ŀ¼ | ||
|
||
[inotifywait] ֻҪʹ��inotifywait���¼�ʱ���Զ�ִ��rsync����ͬ���������ɡ�����ִ��Ȩ���ں�̨���м��� | ||
#!/bin/bash | ||
inotifywait -mrq -e create,close_write,move,delete,modify /var/www/html/ | while read a b c | ||
do | ||
rsync -azP --delete /var/www/html/ [email protected]:/backup(����rsync -azp /backup/ [email protected]::backup --password-file=/et | ||
c/rsync.password) | ||
|
||
[scp] | ||
scp [email protected]:/home/work/source.txt /home/work/ | ||
|
||
###php ��װ | ||
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so | ||
|
||
wget https://dl.eff.org/certbot-auto | ||
chmod a+x certbot-auto | ||
certbot-auto certonly --text --agree-tos --webroot -w /transimg/www/transportjp -d style.transportjp.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,111 +1,111 @@ | ||
SELECT | ||
o.id, | ||
o.shipment, | ||
o.sku, | ||
o.no, | ||
o.num, | ||
o.depot, | ||
o.unit_price, | ||
o.total_price, | ||
i.SumInNum, | ||
o.Sumoutnum, | ||
i.unit_price, | ||
( | ||
SUM( | ||
( | ||
CASE | ||
WHEN i.SumInNum > o.Sumoutnum THEN | ||
o.Sumoutnum | ||
ELSE | ||
i.SumInNum | ||
END - CASE | ||
WHEN o.Sumoutnum - o.num > i.SumInNum - i.num THEN | ||
o.Sumoutnum - o.num | ||
ELSE | ||
i.SumInNum - i.num | ||
END | ||
) * i.unit_price | ||
) / o.num | ||
) costprice, | ||
( | ||
SUM( | ||
( | ||
CASE | ||
WHEN i.SumInNum > o.Sumoutnum THEN | ||
o.Sumoutnum | ||
ELSE | ||
i.SumInNum | ||
END - CASE | ||
WHEN o.Sumoutnum - o.num > i.SumInNum - i.num THEN | ||
o.Sumoutnum - o.num | ||
ELSE | ||
i.SumInNum - i.num | ||
END | ||
) * i.unit_price | ||
) | ||
) costmoney | ||
FROM | ||
( | ||
SELECT | ||
*, ( | ||
SELECT | ||
SUM(num) | ||
FROM | ||
tao86_jppurchases | ||
WHERE | ||
sku = i.sku | ||
AND depot = i.depot | ||
AND ver = ( | ||
SELECT | ||
ver | ||
FROM | ||
tao86_v_jpversion v | ||
WHERE | ||
i.depot = v.depot | ||
) | ||
AND cdate <= i.cdate | ||
) SumInNum | ||
FROM | ||
tao86_jppurchases AS i | ||
) AS i, | ||
( | ||
SELECT | ||
*, ( | ||
SELECT | ||
SUM(num) | ||
FROM | ||
tao86_jpsales | ||
WHERE | ||
sku = i.sku | ||
AND depot = i.depot | ||
AND shipment >= ( | ||
SELECT | ||
mdate | ||
FROM | ||
tao86_v_jpverdate v | ||
WHERE | ||
i.depot = v.depot | ||
) | ||
AND shipment <= i.shipment | ||
) Sumoutnum | ||
FROM | ||
tao86_jpsales AS i | ||
) AS o | ||
WHERE | ||
i.sku = o.sku | ||
AND i.SumInNum - i.num < o.Sumoutnum | ||
AND o.Sumoutnum - o.num < i.SumInNum | ||
AND o.sku = '4992440034713' | ||
AND o.shipment >= '2018-01-01' | ||
AND o.shipment <= '2018-09-01' | ||
AND o.depot = 5 | ||
GROUP BY | ||
o.id, | ||
o.shipment, | ||
o.depot, | ||
o.sku, | ||
o.num, | ||
o.total_price | ||
ORDER BY | ||
o.shipment DESC, | ||
o.id DESC | ||
mysql -uroot -p'' db | ||
|
||
CREATE USER 'username'@'host' IDENTIFIED BY 'password'; | ||
GRANT privileges ON databasename.tablename TO 'username'@'host' | ||
GRANT ALL ON *.* TO 'pig'@'%'; | ||
|
||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.24.63.204' IDENTIFIED BY 'MJsujrctG6pU0OUG' WITH GRANT OPTION; FLUSH PRIVILEGES; | ||
|
||
grant replication slave on *.* to 'replicate'@'218.206.70.146' identified by '123456'; flush privileges; | ||
|
||
show variables like '%query%'; | ||
[mysqld] | ||
log-slow-queries = /home/wwwlogs/mysql_slow_query.log | ||
long_query_time=3 | ||
|
||
ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) | ||
ALTER TABLE `table_name` ADD UNIQUE (`column`) | ||
ALTER TABLE `table_name` ADD INDEX index_name ( `column` ) | ||
ALTER TABLE `table_name` ADD FULLTEXT ( `column`) | ||
ALTER TABLE `table_name` ADD INDEX index_name ( `column1`, `column2`, `column3` ) | ||
|
||
#·Ö¸î×Ö·û¼ÆËã | ||
Select (length(oids) - length(replace(oids,',',''))+1) as onum | ||
|
||
##清除bin日志 | ||
reset master | ||
|
||
####备份脚本#### | ||
#!/bin/sh | ||
ID="root" #用户名 | ||
#PWD="root" #密码 | ||
DBS="db_zy audit" #数据库名字的列表,多个数据库用空格分开。 | ||
BACKPATH="/home/vagrant/Code/mysql" #保存备份的位置 | ||
DAY=7 #保留最近几天的备份 | ||
[ ! -d $backpath ] &&mkdir -p $BACKPATH #判断备份目录是否存在,不存时新建目录。 | ||
cd $BACKPATH #转到备份目录,这句话可以省略。可以直接将路径到命令的也行。 | ||
#生成备份文件的名字的前缀,不带后缀。 | ||
backupname=mysql_$(date +%Y-%m-%d) | ||
for db in $DBS; #dbs是一个数据名字的集合。遍历所有的数据。 | ||
do | ||
mysqldump $db -u$ID -proot > $backupname_$db.sql #备份单个数据为.sql文件。放到当前位置 | ||
done | ||
#压缩所有sql文件 | ||
tar -czf $backupname.tar.gz *.sql | ||
#删除所有的sql文件 | ||
rm -f *.sql | ||
#得到要删除的太旧的备份的名字。 | ||
delname=mysql_$(date -d "$DAY day ago" +%Y-%m-%d).tar.gz | ||
#删除文件 | ||
rm -f $delname | ||
|
||
#### mysqldump | ||
mysqldump -uroot -p123 -h192.131.1.9 --single-transaction --master-data=2 -R --no-data --databases vgos_mcenter vgos_statnum>11.dmp | ||
|
||
--master-data=? | ||
1 设定slave | ||
2 注释设定slave语句 | ||
|
||
--single-transaction | ||
备份时不锁表 无事务myisam表有影响 | ||
|
||
-R | ||
导出存储过程以及自定义函数 | ||
|
||
--no-data | ||
只导出表结构 | ||
|
||
--databases,-B | ||
指定数据库 | ||
|
||
### 导入sql | ||
source 资源路径 | ||
|
||
#### | ||
SELECT username,oid FROM tao86_order WHERE oid IN (473400,471658) ORDER BY INSTR(',473400,471658,',CONCAT(',',oid,',')) | ||
|
||
SET @sum = 0;SELECT max(id),SUM(num) FROM (SELECT id,num,@sum:=@sum+num mysum FROM tao86_jpsales ORDER BY id ASC) t WHERE mysum<=10 | ||
|
||
mysqlbinlog --start-date="2017-08-10 09:00:00" --stop-date="2017-08-10 09:30:00" mysql-bin.000016 > binlog16.txt | ||
|
||
mysql_config_editor set --login-path=test --user=test_user --host=127.0.0.1 --port=3306 --password | ||
|
||
|
||
SELECT | ||
o.id,o.tdate,o.goodcode,o.outnum,o.salePrice | ||
,costprice=CAST(SUM((CASE WHEN i.SumInNum>o.Sumoutnum THEN o.Sumoutnum ELSE i.SumInNum END -CASE WHEN o.Sumoutnum-o.OutNum>i.SumInNum-i.InNum THEN o.Sumoutnum-o.OutNum ELSE i.SumInNum-i.InNum END)*i.Price)/o.outnum AS MONEY) | ||
,costmoney=CAST(SUM((CASE WHEN i.SumInNum>o.Sumoutnum THEN o.Sumoutnum ELSE i.SumInNum END -CASE WHEN o.Sumoutnum-o.OutNum>i.SumInNum-i.InNum THEN o.Sumoutnum-o.OutNum ELSE i.SumInNum-i.InNum END)*i.Price) AS MONEY) | ||
FROM | ||
(SELECT *,SumInNum=(SELECT SUM(InNum) FROM #in WHERE goodcode=i.goodcode AND id<=i.id) FROM #in AS i) AS i, | ||
(SELECT *,Sumoutnum=(SELECT SUM(outnum) FROM #out WHERE goodcode=i.goodcode AND id<=i.id) FROM #out AS i) AS o | ||
WHERE i.goodcode=o.goodcode AND i.SumInNum-i.InNum<o.Sumoutnum AND o.Sumoutnum-o.OutNum<i.SumInNum | ||
GROUP BY o.id,o.tdate,o.goodcode,o.outnum,o.salePrice | ||
|
||
show master status; | ||
###################123456#################### | ||
mysqlbinlog --no-defaults --start-datetime="2016-11-17 00:00:00" --stop-datetime="2016-11-19 23:59:59" ./mysql-bin.000011 --result-file=mysql-bin.000011.sql | ||
|
||
//定位日志记录 | ||
mysqlbinlog --no-defaults -v -v --base64-output=DECODE-ROWS mysql-bin.000167 | grep -A '10' 195993466 | ||
|
||
//定位坐标 | ||
grep -i "CHANGE MASTER TO" mysql.sql | ||
|
||
//修改 slave | ||
CHANGE MASTER TO MASTER_HOST='10.10.1.2',MASTER_USER='replicate',MASTER_PASSWORD='replpassword',MASTER_LOG_FILE='log-bin.log.000001',MASTER_LOG_POS=98 | ||
|
||
//同步跳过某个错误 | ||
STOP SLAVE; | ||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; | ||
START SLAVE; | ||
SHOW SLAVE STATUS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mysqlbinlog --database=db_zy --start-datetime='2018-9-29 0:0:0' --stop-datetime='2018-11-2 23:59:59' mysql-bin.000024 mysql-bin.000072 mysql-bin.000073 mysql-bin.000074 mysql-bin.000075 mysql-bin.000076 mysql-bin.000077 mysql-bin.000078 mysql-bin.000079 mysql-bin.000080 mysql-bin.000081 mysql-bin.000082 mysql-bin.000083 mysql-bin.000084 mysql-bin.000085 mysql-bin.000086 mysql-bin.000087 mysql-bin.000088 mysql-bin.000089 mysql-bin.000090 |grep -E 'tao86_order|tao86_sendorder|tao86_user_goods'|grep -v 'tao86_record_sql'|grep -v 'tao86_orderscan' > /transimg/www/transportjp/data/sql/180929-181102.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,4 +183,7 @@ | |
|
||
// 开立方根 | ||
exp(1/3*log($avolume) | ||
|
||
// curl ssl error | ||
export NSS_STRICT_NOFORK=DISABLED | ||
?> |