工作笔记存档

1:容器中查日志
    cd /usr/local/tomcat/logs
    grep -i "07-12 09:37.*" zte-iscp-ieam-assetapi*
    grep -i ""异步发送统一审批请求异常"" zte-iscp-ieam-assetapi*
    
2:gerrit提交
    git commit -m 'RDC:DT_BO-4150786 null异常修改'
    git push origin HEAD:refs/for/develop
    合并:
        git merge --no-ff dev  
    gerrit按钮:
        cherry pick:当前提交合并到其他分支
        rebase:父单如果不在git log里面可以通过这个合入
        abandon:放弃当前提交
        restore:abandon后会出现此按钮,会撤销abandon

3:select count(*), `type` from asset_bill where Date(gmt_create) > "2023-01-30" group by `type` having count(*) >= 10 
    SQL中json数据取值,设值:JSON_EXTRACT,json_set

4:控制台输出日志级别控制
    logging:
      config: classpath:logback-spring.xml
      level:
        com.zte.itp.devportal.domain.dao: debug

5:Linux 查找当前目录下 包含特定字符串 的所有文件
    find . | xargs grep -ri "开始同步EAMS固定资产EAR信息"

6:Mybatis Log输出格式化日志
    mybatis:
        configuration:
            log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

7:域名 -> nginx -> LB -> 微服务
    saastest.icenter.zte.com.cn经过DNS解析,得到Nginx服务器的地址,即10.54.150.79,在nginx中配置路由转发,ng根据url中的微服务名,匹配到对应的location,
    然后proxy_pass反向代理,转发到对应LB(负载均衡器)上,LB的对外负载均衡ip:10.5.211.69,端口:29031,协议:http,最后LB根据具体的微服务名请求到具体的docker容器进行处理。

8:清理fastDFS中700天之前的文件
    du -lh --max-depth=1
    du -sh * | sort -nr
    find /data/fastdfs/storage/data -type f -size +100M -mtime +90 -name '*.bzip2' | wc -l
    find /data/fastdfs/storage/data -type f -size +100M -mtime +700 -name '*.*' -ok rm -rf {} \;
    查个数,300分钟内修改的文件:
    find /data/fastdfs/storage/data -type f -size +100M -mmin -300 -name '*.ipa' | wc -l
    批量删除,300分钟内修改的文件:
    find /data/fastdfs/storage/data -type f -size +100M -mmin -300 -name '*.ipa' | xargs rm -rf

9: nginx配置中location匹配规则
    多个 location 配置的情况下匹配顺序为:
    首先匹配 =
    其次匹配 ^~
    其次是按文件中顺序的正则匹配
    最后是交给 / 通用匹配
    当有匹配成功时候,停止匹配,按当前匹配规则处理请求

10: NG指定配置文件重启
    /usr/local/openresty/nginx/sbin/nginx -c /usr/local/openresty/nginx/conf/nginx.conf -s reload
    微服务:
    ps -ef | grep nginx 配置中location匹配规则
    需要在  cd /usr/local/openresty/nginx/sbin/    下重新加载
    ./nginx -t  -->测试配置是否出错
    ./nginx -s reload -->重新加载配置

11:查看docker宿主机中的启动日志
    ssh root@192.168.2.6
    docker ps -a | grep zte-itp-devportal-appmc
    docker exec -it 容器ID /bin/bash   docker exec -it {进程号前三位} bash
    cd /usr/local/tomcat/logs/
    tail -500 zte-itp-devportal-appmc_app.log

12:导出esm日志
    curl -u it-ci-erp-eam:eam@123321 -T zte-iscp-ieam-assetapi.log  https://artsz.zte.com.cn/artifactory/it-alpha-generic/erp/eam/apps/zte-erp-eams-web/V2.0.1_Build00142/logs/zte-iscp-ieam-assetapi.log

13:spring_active = dev意义
    userconfig.yml的deploy_configs.nodes.dev.deploy.spring_active = dev,对应取得application-dev.yml的配置
    本地只有application.yml文件,那实际上,这个spring_active: dev就没有起作用

14、正则表达式
    [(][1-9]\d*, 

15、复制报文信息
    JSONObject.toJSONString(entity)

16、查看端口占用情况
        lsof -i:8888
     kill -9 pid
    查看端口启动情况
        netstat -an | grep tcp
        netstat -tlnp | grep java
    查看进程
        ps -aux | grep java

17、linux重复执行watch -d -n 1 'netstat -an | grep  10.90.161.142'

18、daas刷所有数据
    https://user.daasplm.zte.com.cn/#/taskLog
    https://daasplm.zte.com.cn/#/batchTask
    db.getCollection('ProductDev_project_base').find({"daas.lastUpdateTime":{$gte:"#{currenttime}"}})
    db.getCollection('ProductDev_project_base').find({"metadata.id":"1199962"})

19、apiKey
    requestParameter("assetcloud-apikey", "iNKMGVW79w/OcZakXeDxbY0FUcfo/Lo+loS/uh7D1Wx0BdiRy0+BViCNzBC3RAKM");
    requestParameter("debugger-apikey", "mzmvsIrTyZ8c7S85U5ttOdLuCEyyADjU0XxRMVl6jprjwpUPVhptfozfQmaQswjB");

20、Maven手动上传包到制品库
    <distributionManagement>
        <repository>
            <id>central</id>
            <name>it-release-maven</name>
            <url>https://artsz.zte.com.cn/artifactory/it-release-maven/</url>
        </repository>
    </distributionManagement>

21、下载文件,向Response中写入文件,参考ieam的writeFileIntoResponse方法

22、时间类相关操作
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    Date currentDate = dateFormat.parse(lastUpdateDate);
    String lastUpdateDateBegin = StringUtils.join(dateFormat.format(DateHelper.addDays(currentDate, -2)), synTime);

    时间格式化
    DateHelper.formatDateTime(assetBill.getGmtModified())

    sql时间处理函数:
    函数从当前日期减去指定的时间间隔
    <![CDATA[ and gmt_modified <= DATE_SUB(now(),interval #{days,jdbcType=INTEGER}*24 hour) ]]>
    date_sub('2019-07-27', interval 30 day)表示往前推30天

    计算时间间隔
    DATEDIFF(now(), gmt_modified)

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值