技术相关实践记录2

Nginx反向代理无法访问静态文件解决

user  root; #用户
worker_processes  1;

error_log  logs/nginx_error.log; #要保证有指定的目录和文件,否则nginx启动会报错
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    server {
        listen       80; #监听80端口,就是直接输入域名就可以
        server_name  www.addoiles.com;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;

        location / {
        #如果无法加载静态资源是应为这个填写ip没有填写域名的原因,应为网站通过域名DNS解析到ip,直接写ip不走dns,也就访问不到静态资源
            #和本地调试不是一回事
            proxy_pass http://www.addoiles.com:8080/addoiles.com-1.0/;
        }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

mysql 数据导入导出

-- select * from oil_article;

-- 截止2017-9-11 15:19最新数据,后面的都是新增的数据,需要同步
select max(id) from oil_article where create_time <= 1502242390;

-- 查询出需要同步的数据,即增量的数据
select * from oil_article where create_time > 1502242390;

-- 增量的数据导出到文件
select * from oil_article where create_time > 1502242390 into outfile 'd:/test_add_datas.txt';

-- 增量数据导入到sync_oil_article库中的oil_article表
load data infile 'd:/test_add_datas.txt' into table sync_oil_article.oil_article;

-- REPLACE和IGNORE关键词控制对现有的唯一键记录的重复的处理。如果你指定REPLACE,新行将代替有相同的唯一键值的现有行。如果你 指定IGNORE,跳过有唯一键的现有行的重复行的输入。
-- 如果你不指定任何一个选项,当找到重复键键时,出现一个错误,并且文本文件的余下部分被忽略
-- repalce 
load data infile 'd:/test_add_datas.txt' replace into table sync_oil_article.oil_article;

-- ignore
load data infile 'd:/test_add_datas.txt' ignore into table sync_oil_article.oil_article;


-- 导出导出分隔符要统一
select * from oil_article where create_time > 1502242390 into outfile 'd:/test_add_datas_u.txt' fields terminated by ',';
load data infile 'd:/test_add_datas_u.txt' into table sync_oil_article.oil_article fields terminated by ',';

-- 指定OPTIONALLY ENCLOSED BY CHAR和VARCHAR字段将被""包含
select * from oil_article where create_time > 1502242390 into outfile 'd:/test_add_datas_u2.txt' fields terminated by ',' optionally enclosed by '"';

-- 同理一行一行
select * from oil_article where create_time > 1502242390 into outfile 'd:/test_add_datas_u4.txt' fields terminated by ',' optionally enclosed by '"' lines terminated by '\ndfs';



-- 语法: LOAD DATA [LOW_PRIORITY] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE] [FIELDS [TERMINATED BY '\t'] [OPTIONALLY] ENCLOSED BY ''][ESCAPED BY '\\' ]][LINES TERMINATED BY '\n'][IGNORE number LINES][(col_name,...)]



-- mysqldump导出整个表的数据,包括建表信息,这也是最基础的用法
mysqldump -uroot -proot addoiles oil_article > d:/addoiles_oil_article.txt;
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值