zoukankan      html  css  js  c++  java
  • 知识点

    1. Linux

    1.1 tar.gz解压缩

    解压:tar xzvf flight-8.1.0.0417.tar.gz

    压缩:tar czvf lbs-8.1.0.0417.tar.gz lbs/

    1.2 find查找文件

    find / -name httpd.conf 

    1.3 查看端口占用

    netstat -anp | grep 80

    1.4 改变文件属主

    chown -R root:root path

    1.5 查看linux版本

    1. uname -a   (Linux查看版本当前操作系统内核信息)

    2. cat /proc/version (Linux查看当前操作系统版本信息)

    3. cat /etc/issue(Linux查看版本当前操作系统发行版信息)

    4. getconf LONG_BIT  (Linux查看版本说明当前CPU运行在32bit模式下, 但不代表CPU不支持64bit)

    5. lsb_release -a

    6. cat /proc/cpuinfo (Linux查看cpu相关信息,包括型号、主频、内核信息等)

    host-10-28-0-189:~ # cat /proc/cpuinfo
    processor : 0
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 0
    cpu cores : 8
    apicid : 0
    initial apicid : 0
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 1
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 2
    cpu cores : 8
    apicid : 2
    initial apicid : 2
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 2
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 4
    cpu cores : 8
    apicid : 4
    initial apicid : 4
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 3
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 6
    cpu cores : 8
    apicid : 6
    initial apicid : 6
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 4
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 8
    cpu cores : 8
    apicid : 8
    initial apicid : 8
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 5
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 10
    cpu cores : 8
    apicid : 10
    initial apicid : 10
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 6
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 12
    cpu cores : 8
    apicid : 12
    initial apicid : 12
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    processor : 7
    vendor_id : GenuineIntel
    cpu family : 6
    model : 63
    model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
    stepping : 2
    microcode : 56
    cpu MHz : 2494.155
    cache size : 30720 KB
    physical id : 0
    siblings : 8
    core id : 14
    cpu cores : 8
    apicid : 14
    initial apicid : 14
    fpu : yes
    fpu_exception : yes
    cpuid level : 13
    wp : yes
    flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm xsaveopt fsgsbase bmi1 avx2 smep bmi2 erms invpcid
    bogomips : 4988.31
    clflush size : 64
    cache_alignment : 64
    address sizes : 46 bits physical, 48 bits virtual
    power management:

    1.6 监控网络流量

     下载工具nmon,然后放在目录/opt,然后chmod +x nmon,执行./nmon,然后按n,进入网络监控模式。

    1.7 查看网卡带宽大小

    ethtool工具下载地址:https://mirrors.edge.kernel.org/pub/software/network/ethtool/

    2. mysql

    2.1 查看创建索引

    查看:SHOW INDEX FROM t_weather;其中t_weather为表名。

    创建:create index date_index on t_weather (date);其中date_index为索引名称,t_weather为表名,date为表中需要建立索引的字段。

    2.2 查看mysql的所有设置、查看mysql数据文件存储位置

    mysql> show global variables;

    mysql> show global variables like "%datadir%";

    3. Java

    3.1 dump出内存

    jmap -dump:live,format=b,file=dump.hprof 24971

    3.2 Eclipse启动时指定JDK/JRE

    在 Eclipse 安装上下的 eclipse.ini 文件中添加如下两行:

    -vm
    e:/Program/Java/jdk1.5.0_22/bin/javaw.exe

     第一行为参数名称,第二行为参数值

    4. 网络

    4.1 抓包

    tcpdump -i any tcp and port 3005

    tcpdump -i any tcp and port 3005 -w 3005.pcap

    4.2 测试TCP三次握手时间

    公司内部网络环境,利用tcp抓包【点击下载】,然后统计时间得出。

    并发测试63次握手耗时:

    2018-05-08 09:32:44.735616 ~ 2018-05-08 09:32:45.276107 

    大约耗时541ms,所以一次TCP连接的耗时大约是541/63 = 8.587ms

    5. nginx/openresty

    5.1 配置静态页面 

    (1)nginx.conf配置

     server {
            listen       8081;
            client_max_body_size 100m;
            ……
            
            location /site {
                root   html;
                index  upload.html;
            }
    }
    

    (2)将upload.html放在html/site/

    (3)浏览器中访问http://127.0.0.1:80/site或http://127.0.0.1:80/site/upload.html

    5.2 获取请求body

    location /rest.php {
               content_by_lua_block {
                      ngx.req.read_body(); # 必须要先执行这句,否则获取不到请求body
                      ngx.say(ngx.req.get_body_data());
               }
    }
    

      

    6. Git

    6.1 Your local changes to the following files would be overwritten by merge

    如果系统中有一些配置文件在服务器上做了配置修改,然后后续开发又新添加一些配置项的时候,

    在发布这个配置文件的时候,会发生代码冲突:

    error: Your local changes to the following files would be overwritten by merge:
            protected/config/main.php
    Please, commit your changes or stash them before you can merge.

    如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:

    git stash
    git pull
    git stash pop

    然后可以使用git diff -w +文件名 来确认代码自动合并的情况.

    反过来,如果希望用代码库中的文件完全覆盖本地工作版本. 方法如下:

    git reset --hard
    git pull

    其中git reset是针对版本,如果想针对文件回退本地修改,使用

    git checkout HEAD src/main/java/com/lj/InitWeatherService.java

     

  • 相关阅读:
    HDU2141 Can you find it?(搜索,二分)
    HDU1253 胜利大逃亡(搜索)
    辗转相除法证明
    POJ2230 Watchcow(欧拉回路)
    POJ2524Ubiquitous Religions, 1611The Suspects(并查集)
    POJ3259 Wormholes(最短路)
    HDU3018Ant Trip(欧拉回路)
    SDUT1500Message Flood(字典树)
    HDU1010 Tempter of the Bone(搜索,dfs)
    HDU1305Immediate Decodability(字典树)
  • 原文地址:https://www.cnblogs.com/lujiango/p/9001006.html
Copyright © 2011-2022 走看看