zoukankan      html  css  js  c++  java
  • 数据仓库004

    一、复习

     1、vi的使用方法:

      1.1 、正常编辑一个文件,保存退出

      1.2、 粘贴的坑:必须在i键 编辑模式

     2、找error

      cat xxx.log | grep -C 10 ERROR > error.log

      cat more sz

      进入尾行模式:/关键词 回车自动匹配 按N键找寻下一个

     3、设置行号

      进入尾行模式:
        set nu
        set nonu

    4、清空这个内容

      cat /dev/null > xxx.log 完美

      echo '' > xxx.log 存在1个字节

    5、命令行模式常见的快捷键:

      dd 删除当前行
      dG 删除光标当前及以下的所有行
      ndd 删除光标当前及以下的n行

      gg 跳转到第一行的第一个字母
      G 跳转到最后一行的第一个字母
      shift+$ 行尾

      gg + dG

    二、进程 端口号

     1、系统命令-磁盘

    [root@localhost ~]# df -h
    文件系统              容量  已用 可用 已用% 挂载点
    /dev/mapper/VolGroup00-LogVol00
                           15G  3.8G   11G  27% /
    /dev/sda1              99M   14M   81M  15% /boot
    tmpfs                 829M     0  829M   0% /dev/shm
    none                  829M  104K  829M   1% /var/lib/xenstored
    /dev/scd0             2.9G  2.9G     0 100% /media/RHEL_5.5 i386 DVD
    [root@localhost ~]# 

     2、系统命令-内存

    [root@localhost ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:          1658        971        686          0        119        519
    -/+ buffers/cache:        332       1325
    Swap:         5023          0       5023
    [root@localhost ~]# 

    3、系统命令-负载

    [root@localhost ~]# top
    top - 02:29:38 up  2:32,  4 users,  load average: 0.00, 0.00, 0.00
    Tasks: 213 total,   2 running, 210 sleeping,   0 stopped,   1 zombie
    Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   1697792k total,   994768k used,   703024k free,   122228k buffers
    Swap:  5144568k total,        0k used,  5144568k free,   531792k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
        1 root      15   0  2088  644  552 S  0.0  0.0   0:00.54 init               
        2 root      RT  -5     0    0    0 S  0.0  0.0   0:02.83 migration/0        
        3 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0        
        4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0         
        5 root      RT  -5     0    0    0 S  0.0  0.0   0:02.62 migration/1        
        6 root      36  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/1        
        7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1         
        8 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 events/0           
        9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 events/1           
       10 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper            
       11 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread            
       13 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 xenwatch           
       14 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 xenbus             
       17 root      10  -5     0    0    0 S  0.0  0.0   0:00.12 kblockd/0          
       18 root      10  -5     0    0    0 S  0.0  0.0   0:00.03 kblockd/1          
       19 root      15  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid             
      180 root      13  -5     0    0    0 S  0.0  0.0   0:00.00 cqueue/0           
    [root@localhost ~]# 

      经验值 不要超过10 否则认为此物理服务器 IDC机房100,100,100     2颗GPU 56物理core

    4、系统命令-查看进程 查看端口号

     4.1 进程

    [root@localhost ~]# ps -ef|grep ssh
    root 4377 1 0 Nov21 ? 00:00:00 /usr/sbin/sshd
    linux 5569 5534 0 Nov21 ? 00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "/usr/bin/dbus-launch --exit-with-session /etc/X11/xinit/Xclients"
    root 6710 4377 0 00:09 ? 00:00:00 sshd: root@pts/1
    root 8451 4377 0 00:30 ? 00:00:00 sshd: root@pts/3
    root 9018 8943 0 02:29 pts/3 00:00:00 grep ssh
    [root@localhost ~]#
    [root@localhost ~]# ps -ef|grep ssh | grep -v grep
    root 4377 1 0 Nov21 ? 00:00:00 /usr/sbin/sshd
    linux 5569 5534 0 Nov21 ? 00:00:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "/usr/bin/dbus-launch --exit-with-session /etc/X11/xinit/Xclients"
    root 6710 4377 0 00:09 ? 00:00:00 sshd: root@pts/1
    root 8451 4377 0 00:30 ? 00:00:00 sshd: root@pts/3
    [root@localhost ~]#

     4.2端口号

    [root@localhost ~]# netstat -nlp |grep 6710
    [root@localhost ~]# netstat -nlp |grep 762
    unix  2      [ ACC ]     STREAM     LISTENING     17622  4896/xenstored      /var/run/xenstored/socket
    unix  2      [ ACC ]     STREAM     LISTENING     17623  4896/xenstored      /var/run/xenstored/socket_ro
    [root@localhost ~]# netstat -nlp |grep 74886
    [root@localhost ~]# netstat -nlp |grep ssh
    tcp        0      0 :::22                       :::*                        LISTEN      4377/sshd           
    unix  2      [ ACC ]     STREAM     LISTENING     19951  5569/ssh-agent      /tmp/ssh-uUAfXg5534/agent.5534
    [root@localhost ~]# 

      

      通过pid找port
        1: 启动一个进程 ps 必须
        2: 可能启动一个port netstat 不是必须

    三、连接拒绝 (权限受限)

    四、高危命令 

      rm -rf /

      当vi 生产配置文件 100行时, 保存并备份, cp xxx.xml xxx.xml20191117

      ps 进程 xxx,top命令查询夯住的 / 删除xxx进程
      kill -9 进程pid
      kill -9 进程pid 进程pid 进程pid
      kill -9 $(pgrep -f 匹配关键词)

      杀进程之前,先ps 找到相关的进程,搞清楚,哪些是你要杀的,不然造成生产事故

    [root@ruozedata001 conf]# ps -ef|grep http
    root      91733      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91734  91733  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91735  91733  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91736  91733  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91737  91733  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91738  91733  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    root      93161  83057  0 22:46 pts/1    00:00:00 grep --color=auto http
    [root@ruozedata001 conf]# kill -9 91733
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# ps -ef|grep http
    apache    91734      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91735      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91736      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91737      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91738      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    root      93185  83057  0 22:46 pts/1    00:00:00 grep --color=auto http
    [root@ruozedata001 conf]# kill -9 91734  91735  91736  
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# ps -ef|grep http
    apache    91737      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    apache    91738      1  0 22:38 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
    root      93207  83057  0 22:46 pts/1    00:00:00 grep --color=auto http
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# echo $(pgrep -f http)
    91737 91738
    [root@ruozedata001 conf]# pgrep -f http
    91737
    91738
    [root@ruozedata001 conf]# kill -9 $(pgrep -f http)
    kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# pgrep -f http
    [root@ruozedata001 conf]# ps -ef|grep http
    root      93533  83057  0 22:48 pts/1    00:00:00 grep --color=auto http
    [root@ruozedata001 conf]# 
    ruozedata001

    五、常用的 wget yum rpm  压缩

    yum search xxx
    yum install -y xxx-yyy
    yum remove xxx-yyy
    
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# rpm -qa | grep http
    httpd-2.4.6-90.el7.centos.x86_64
    httpd-tools-2.4.6-90.el7.centos.x86_64
    [root@ruozedata001 conf]# 
    
    
    [root@ruozedata001 conf]# rpm -e httpd-tools-2.4.6-90.el7.centos.x86_64
    error: Failed dependencies:
            httpd-tools = 2.4.6-90.el7.centos is needed by (installed) httpd-2.4.6-90.el7.centos.x86_64
    [root@ruozedata001 conf]# 
    
    
    先删除httpd-2.4.6-90.el7.centos.x86_64
    httpd-tools-2.4.6-90.el7.centos.x86_64
    
    rpm -e --nodeps httpd-tools-2.4.6-90.el7.centos.x86_64
    
    --nodeps  不校验,直接删除
    [root@ruozedata001 conf]# rpm -qa | grep http
    httpd-tools-2.4.6-90.el7.centos.x86_64
    httpd-2.4.6-90.el7.centos.x86_64
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# 
    [root@ruozedata001 conf]# rpm -e  --nodeps     httpd-tools-2.4.6-90.el7.centos.x86_64
    [root@ruozedata001 conf]# rpm -qa | grep http
    httpd-2.4.6-90.el7.centos.x86_64
    [root@ruozedata001 conf]# 
    
    
    6.wget下载安装包
    wget http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.6.0-cdh5.16.2.tar.gz
    
    7.压缩解压
    
    zip
    zip -r xxx.zip ./*  在文件夹里面 
    zip -r ruozedata.zip ruozedata/* 在外面
    
    unzip ruozedata.zip
    
    大数据组件的压缩包几乎都是后缀 tar.gz
    tar -xzvf hadoop-2.6.0-cdh5.16.2.tar.gz
    tar -czvf hadoop-2.6.0-cdh5.16.2.tar.gz  hadoop-2.6.0-cdh5.16.2/*
    
    
    Examples:
      tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
      tar -tvf archive.tar         # List all files in archive.tar verbosely.
      tar -xf archive.tar          # Extract all files from archive.tar.
    ruozedata001
  • 相关阅读:
    Spring AOP功能
    EasyUI组件treegrid构建树形组织机构
    EasyUI树形表格显示Json数据
    Java 操作Redis
    Linux安装Redis、后台运行、系统自启动
    SpringBoot-Helloworld
    中小后台系统UI框架--EasyUI
    Spring注解--实现applicationContext.xml效果
    Mybatis XML映射文件
    python初学者必看学习路线图!!!
  • 原文地址:https://www.cnblogs.com/Raodi/p/11909450.html
Copyright © 2011-2022 走看看