隨筆-314  評論-209  文章-0  trackbacks-0

          我的評論

          共3頁: 1 2 3 下一頁 
          re: Hive中reduce個數設定 xzc 2018-03-07 11:43  
          use DBHIVE;
          set mapreduce.job.queuename=root.xqueue;
          set hive.exec.stagingdir=/tmp/hive-staging;
          #set hive.exec.reducers.bytes.per.reducer=1024000000;
          set mapred.reduce.tasks = 50;
          INSERT OVERWRITE DIRECTORY '/user/gxhb/BILL_FEE_1707/EVENT_CDR' row format delimited fields terminated by '#' select rowkeyid,event_type_id,select_col,merge_col,base_table_name from tmp_bill_fee_1707 a where base_table_name='EVENT_CDR';
          sync_time=`cat ods_data_msg_sync_time`
          diff_time=$(($(date +%s) - $(date +%s -d "${sync_time}")));

          a=sunceenjoy
          if echo $a|grep -qe '^sun' ;then echo yes;else echo no ;fi;

          hostname=i001.hadoop.gx.cn
          if [ "${hostname:0:1}" == "n" -o "${hostname:0:1}" == "i" ]; then echo true; else echo false; fi
          re: shell判斷文件是否存在 xzc 2017-06-17 09:57  
          hostname=i001
          if [ "${hostname:0:1}" == "n" -o "${hostname:0:1}" == "i" ]; then echo true; else echo false; fi

          Curl是Linux下一個很強大的http命令行工具,其功能十分強大。

          一、CURL對HTTP的常規訪問

          1. 訪問網站

          $ curl http://www.linuxidc.com

          回車之后,www.linuxidc.com 的html 顯示在屏幕上了

          2. 保存頁面

          用curl option: -o

          $ curl -o page.html http://www.linuxidc.com

          可以看到屏幕上出現一個下載頁面進度指示,等到100%,就保存完成了.

          二、GET模式

          GET模式什么option都不用,只需要把變量寫在url里面就可以了,

          例如:

          $ curl http://www.linuxidc.com/test.cgi?param1=nickwolfe&param2=12345

          三、POST模式

          使用 option -d,

          例如:

          $ curl -d "param2=nickwolfe&param2=12345" http://www.linuxidc.com/login.cgi

          更多
          netstat -nat|grep -i "10000"|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -rn
          netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -rn

          netstat用法:
          -a (all)顯示所有選項,默認不顯示LISTEN相關
          -t (tcp)僅顯示tcp相關選項
          -u (udp)僅顯示udp相關選項
          -n 拒絕顯示別名,能顯示數字的全部轉化成數字。
          -l 僅列出有在 Listen (監聽) 的服務狀態

          -p 顯示建立相關鏈接的程序名
          -r 顯示路由信息,路由表
          -e 顯示擴展信息,例如uid等
          -s 按各個協議進行統計
          -c 每隔一個固定時間,執行該netstat命令。

          提示:LISTEN和LISTENING的狀態只有用-a或者-l才能看到
          netstat -nat|grep -i "10000"
          re: Kerberos簡介 xzc 2017-04-25 17:44  
          kerberos認證過程(3次通信)
          1.次通信
          [客戶端] -> [明文]用戶ID -> [KDC](Authentication Server) -> [KDC密碼]TGT(TGS會話密碼)+[客戶端密碼]用戶ID/TGS會話密碼 -> [客戶端]
          2.次通信
          [客戶端] -> [TGS會話密碼]用戶ID+[明文]HTTP服務名+TGT(TGS會話密碼) ->[KDC](Ticket Granting Server) -> [服務端密碼]ST(服務會話密碼)+[TGS會話密碼]HTTP服務名/服務會話密碼 -> [客戶端]
          3.次通信
          [客戶端] -> [服務會話密碼]用戶ID+[服務端密碼]ST(服務會話密碼) -> [服務端] -> [服務會話密碼]HTTP服務名 -> [客戶端]
          注:客戶端:java代碼客戶端
          KDC:kerberos認證服務器
          服務端:HTTP服務器
          re: Kerberos簡介 xzc 2017-04-25 15:57  
          krb5kdc --認證
          kadmin --管理賬戶
          [@i002 ~]$ more /etc/ntp.conf
          restrict default kod nomodify notrap nopeer noquery
          restrict -6 default kod nomodify notrap nopeer noquery
          restrict 127.0.0.1
          restrict -6 ::1

          #restrict 91.4.0.0 netmask 255.255.255.0
          #restrict 91.5.0.0 netmask 255.255.255.0
          #restrict 91.5.1.0 netmask 255.255.255.0

          server 134.192.232.14

          # unset default server
          #server 127.127.1.0
          #fudge 127.127.1.0 stratum 10

          driftfile /var/lib/ntp/drift
          keys /etc/ntp/keys
          ntpq -p
          service ntpd status
          service ntpd stop && ntpdate 134.201.27.12 && service ntpd start

          server 0.cn.pool.ntp.org
          server 1.cn.pool.ntp.org
          server 2.cn.pool.ntp.org
          server 3.cn.pool.ntp.org
          find ./ -inum 83068 -print -exec rm -rf {} \;
          根據i節點刪除
          ls -i
          find ./ -inum 83068 -print -exec rm {} \;
          find ./ -ctime +30 -print -exec rm {} \;
          re: Shell中的IFS解惑 xzc 2016-04-01 15:01  
          #測試
          index_value1="a b c"
          index_value2="1 2 3"
          ifs=$IFS
          echo ":${ifs}:"
          IFS=$'\n'
          for i1 in ${index_value1}
          do
          echo ${i1}
          IFS=$ifs
          for i2 in ${index_value2}
          do
          echo ${i1} ${i2}
          done
          done
          select DATE_ADD(Now(),INTERVAL -1 hour);select DATE_ADD(CURRENT_TIME(),INTERVAL -1 hour);
          select str_to_date('20160322 12:00:00', '%Y%m%d %T');;
          comm -23 ${logs_path}/${shell_name}_${file_name_prefix}_ftp.log ${logs_path}/${shell_name}_${file_name_prefix}_hdfs.log
          #取10分鐘前的日期,解決日期跨界問題
          day_id=`date -d '30 minute ago' +%Y%m%d`
          rsync -a --delete blanktest/ inf_ws_exchange_log_bak/
          linux的終端上,沒有windows的搜索那樣好用的圖形界面工具,但find命令確是很強大的。

            比如按名字查找一個文件,可以用 find / -name targetfilename 。 唉,如果只知道名字,不知道地點,這樣也不失為一個野蠻有效的方法。

            按時間查找也有參數 -atime 訪問時間 -ctime 改變狀態的時間 -mtime修改的時間。但要注意,這里的時間是以24小時為單位的。查看man手冊后使用,你會很迷惑: -mtime n: Files data was last modified n*24 hours ago. 字面上的理解是最后一次修改發生在n個24小時以前的文件,但實際上

            find ./ -mtime 0:返回最近24小時內修改過的文件。

            find ./ -mtime 1 : 返回的是前48~24小時修改過的文件。而不是48小時以內修改過的文件。

            那怎么返回10天內修改過的文件?find還可以支持表達式關系運算,所以可以把最近幾天的數據一天天的加起來:

            find ./ -mtime 0 -o -mtime 1 -o -mtime 2 ……雖然比較土,但也算是個方法了。

            還有沒有更好的方法,我也想知道。

            另外, -mmin參數-cmin / - amin也是類似的。

          re: sed替換單引號 xzc 2015-11-27 18:08  
          linux系統中,利用grep打印匹配的上下幾行

          如果在只是想匹配模式的上下幾行,grep可以實現。

          $grep -5 'parttern' inputfile //打印匹配行的前后5行

          $grep -C 5 'parttern' inputfile //打印匹配行的前后5行

          $grep -A 5 'parttern' inputfile //打印匹配行的后5行

          $grep -B 5 'parttern' inputfile //打印匹配行的前5行

          it動力測試如下:
          查看mysql慢日志中ip地址為192.168.0.10發送過來的SQL語句的后面三行

          C/C++ Code復制內容到剪貼板
          tail -50 /usr/local/mysql/data/sql-slow.log |grep -3 '192.168.0.10'
          $ find /home/gxeda/data -type f
          /home/gxeda/data/p_cdr_table_type=5/.hive-staging_hive_2015-10-27_15-12-31_755_7195444337062300569-7182/_tmp.-ext-10000/000000_0
          /home/gxeda/data/p_cdr_table_type=5/.hive-staging_hive_2015-10-27_15-12-31_755_7195444337062300569-7182/-ext-10001/tmpstats-0
          /home/gxeda/data/p_cdr_table_type=5/000000_0
          /home/gxeda/data/p_cdr_table_type=12/000000_0
          /home/gxeda/data/p_cdr_table_type=3/000000_0
          /home/gxeda/data/p_cdr_table_type=10/000000_0
          $ find /home/gxeda/data -type f ! -path "*/.*"
          /home/gxeda/data/p_cdr_table_type=5/000000_0
          /home/gxeda/data/p_cdr_table_type=12/000000_0
          /home/gxeda/data/p_cdr_table_type=3/000000_0
          /home/gxeda/data/p_cdr_table_type=10/000000_0
          re: CURL常用命令 xzc 2015-09-23 16:58  
          curl -s -w " ::::: bdpapp01(9701): "%{time_total}"s\n" --header "token:xxx_token" --connect-timeout 60 --max-time 60 "http://127.0.0.1:9701/BDP/service/CRMDB/CRMTEST/scan?q=&fl=&sort=&s=0&e=z&c=&o=&l=1"
          re: CURL常用命令 xzc 2015-09-23 16:56  
          curl -X POST --header "token:xxx_token" "http://127.0.0.1:9701/BDP/service/CRMDB/CRM_TEST/get?q=1"
          function myfunc()
          {
          local myresult='some value'
          echo "$myresult"
          }

          result=$(myfunc) # or result=`myfunc`
          echo $result
          function myfunc()
          {
          local __resultvar=$1
          local myresult='some value'
          eval $__resultvar="'$myresult'"
          }

          myfunc result
          echo $result
          re: 用dmidecode - 查看硬件信息 xzc 2015-09-10 11:24  
          dmidecode -t system
          re: MySQL隔離級別 xzc 2015-03-31 10:11  
          select @@global.tx_isolation,@@tx_isolation;
          re: MySQL隔離級別 xzc 2015-01-15 20:00  
          SET [SESSION | GLOBAL] TRANSACTION ISOLATION LEVEL {READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE}
          re: MySQL隔離級別 xzc 2015-01-15 20:00  
          set global tx_isolation='READ-COMMITTED';
          re: Linux netstat命令詳解 xzc 2014-12-29 16:54  
          netstat -pt|grep 60030
          ps -ef|grep 8080

          lsof -i :60030

          netstat -apn |awk '{print $4}'|awk -F: '{print $2}' >ss.txt
          import java.util.Date
          Date.new().getTime()
          scan 'HISPP_WO_ORDER_INFO', {TIMERANGE => [1416455654039, 2416455654039]}
          scan 'HISPP_WO_ORDER_INFO', {COLUMNS => 'cf:ROW_WOI_ID', TIMERANGE => [1416455654039, 2416455654039]}
          re: Unix常用命令 xzc 2012-07-18 11:27  
          shell如何實現 數字自動補零 字符串自動補零 awk
          作者:lorry 日期:2012-01-12
          字體大小: 小 中 大

          大家在處理數據文件的時候,可能會遇到這個問題,shell 對字符串進行處理,如果字符串 長度不足3位,需要左邊自動補0。比如:12,自動補齊為 012
          解決的方法有兩種,一種是shell的pringf命令,另一種是使用神器awk :

          printf "%04d\n" 12
          echo 12|awk '{printf("%03d\n",$0)}'
          SQL> select wm_concat(lan_id) from rr_lan;

          WM_CONCAT(LAN_ID)
          --------------------------------------------------------------------------------
          471,470,472,473,474,475,476,477,478,479,482,483
          SQL> select replace(wm_concat(menu_name), ',', '->')
          2 from (select level, a.*
          3 from mm_menu a
          4 start with menu_id = 1021057
          5 connect by menu_id = prior super_id
          6 order by level desc);

          REPLACE(WM_CONCAT(MENU_NAME),'
          --------------------------------------------------------------------------------
          系統菜單->系統管理->數據質量->業務發展(分公司)->WIFI場景建設效益監控報表
          --周末
          select day_id, to_char(day_id, 'DAY')
          from (select to_date('201205', 'YYYYMM') - 1 + rownum day_id
          from user_objects
          where rownum <= to_char(last_day(to_date('201205', 'YYYYMM')), 'DD'))
          where to_char(day_id, 'd') in (1, 7);
          select to_char(day_id, 'YYYYMMDD')
          from (select to_date('20120526', 'YYYYMMDD') - rownum + 1 day_id
          from user_objects
          where rownum <= substr(20120526, 7, 2))
          where to_char(day_id, 'd') in (1, 7);
          --星期一~星期五
          select day_id, to_char(day_id, 'DAY')
          from (select to_date('201205', 'YYYYMM') - 1 + rownum day_id
          from user_objects
          where rownum <= to_char(last_day(to_date('201205', 'YYYYMM')), 'DD'))
          where to_char(day_id, 'd') in (2, 3, 4, 5, 6);
          select to_char(day_id, 'YYYYMMDD')
          from (select to_date('20120526', 'YYYYMMDD') - rownum + 1 day_id
          from user_objects
          where rownum <= substr(20120526, 7, 2))
          where to_char(day_id, 'd') in (2, 3, 4, 5, 6);
          --當月的日列表
          select to_char(sysdate - rownum, 'YYYYMMDD') day_id from user_objects where rownum < to_char(sysdate, 'DD');
          --某月的日列表
          select to_char(to_date('201007', 'YYYYMM') - 1 + rownum, 'YYYYMMDD') day_id
          from user_objects
          where rownum <= to_char(last_day(to_date('201007', 'YYYYMM')), 'DD');
          re: Oracle SQL 內置函數大全 xzc 2012-03-31 11:35  

          SQL> create table test(A VARCHAR2(20), N VARCHAR2(20));

          Table created
          SQL> insert into test values('a1','4');

          1 row inserted

          SQL> insert into test values('a1','1');

          1 row inserted

          SQL> insert into test values('a1','5');

          1 row inserted

          SQL> insert into test values('a1','2');

          1 row inserted

          SQL> insert into test values('a1','3');

          1 row inserted

          SQL> insert into test values('a1','3');

          1 row inserted

          SQL> insert into test values('a2','902404');

          1 row inserted

          SQL> insert into test values('a2','33');

          1 row inserted

          SQL> insert into test values('a2','33');

          1 row inserted

          SQL> insert into test values('a2','33');

          1 row inserted
          SQL> select A,
          2 max(decode(tt,1,N,null)) test1,
          3 max(decode(tt,2,N,null)) test2,
          4 max(decode(tt,3,N,null)) test3,
          5 max(decode(tt,4,N,null)) test4,
          6 max(decode(tt,5,N,null)) test5,
          7 max(decode(tt,6,N,null)) test6
          8 from (
          9 select A,N,
          10 row_number() over(partition by A order by N) tt
          11 from test
          12 ) group by A
          13 ;

          A TEST1 TEST2 TEST3 TEST4 TEST5 TEST6
          -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- --------------------
          a1 1 2 3 3 4 5
          a2 33 33 33 902404
          re: Oracle SQL 內置函數大全 xzc 2012-03-31 11:28  
          打橫處理:
          SQL> select index_id, index_name, max(decode(ms_area_id, 100, index_value)), max(decode(ms_area_id, 806, index_value))
          2 from rpt_group_bonus_mon
          3 group by index_id, index_name
          4 order by index_id;
          re: js 高級編程[未登錄] xzc 2011-12-22 09:36  
          function myClass(id, name)
          {
          this.ID = id;
          this.Name = name;
          }

          myClass.prototype =
          {
          showMessage: function()
          {
          alert("ID: " + this.ID + ", Name: " + this.Name);
          },
          showMessage2: function()
          {
          alert("Method2");
          }
          }

          var obj1 = new myClass(1, "johnson");
          obj1.showMessage();
          obj1.Name="John";
          obj1.showMessage();
          var obj2 = new myClass(2, "Amanda");
          obj2.showMessage();
          re: js 高級編程[未登錄] xzc 2011-12-22 09:36  
          function subClass(){ }
          subClass.prototype =
          {
          Name: "sub"
          }

          function myClass()
          {
          //構造函數
          }

          myClass.prototype =
          {
          ID: 1,
          Name: "johnson",
          SubObj: new subClass(),
          showMessage: function()
          {
          alert("ID: " + this.ID + ", Name: " + this.Name + "SubObj.Name:" + this.SubObj.Name);
          }
          }

          var obj1 = new myClass();
          obj1.SubObj.Name = "XXX";
          obj1.showMessage();
          var obj2 = new myClass();
          obj2.showMessage();
          --IP解釋
          select a.*,
          substr(a.begin_ip_sub, 1, instr(a.begin_ip_sub, '.', 1, 1) - 1),
          substr(a.begin_ip_sub,
          instr(a.begin_ip_sub, '.', 1, 1) + 1,
          instr(substr(a.begin_ip_sub, instr(a.begin_ip_sub, '.', 1, 1) + 1), '.') - 1),
          substr(a.begin_ip_sub,
          instr(a.begin_ip_sub, '.', 1, 2) + 1,
          instr(substr(a.begin_ip_sub, instr(a.begin_ip_sub, '.', 1, 2) + 1), '.') - 1),
          substr(a.begin_ip_sub, instr(a.begin_ip_sub, '.', 1, 3) + 1)
          from twb_ip_lan_config a;
          re: Java 位運算符 xzc 2011-11-04 12:59  
          public static final String toHex(byte b) {
          return ("" + "0123456789ABCDEF".charAt(0xf & b >> 4) + "0123456789ABCDEF".charAt(b & 0xf));
          }
          這樣比你那樣方便多了 呵呵 用我給你的方法單個解析byte就可以了
          grant all on sys.utl_file to edp_sso
          GRANT READ ON DIRECTORY data_pump_dir TO edp_sso;
          GRANT WRITE ON DIRECTORY data_pump_dir TO edp_sso;
          用法說明:
          awk -f ngn.awk ss.txt>new.txt
          ss.txt為源文件
          new.txt為處理結果文件
          把ngn.awk放到shell目錄下

          #ngn.awk
          BEGIN {
          FS = ":";
          }
          {
          if(substr($1,1,9) == "ENDOFUSER") {
          printf ("%s|%s\n",baseinfo,camelinfo);
          authinfo = "";
          baseinfo = "";
          ssdata = "";
          camelinfo ="";
          } else if ($1 == "AUTHINFO") {
          #split($2,a,",");
          #authinfo = "";
          } else if ($1 == "BASEINFO") {
          split($2,a,",");
          baseinfo=a[1]"|"a[2]"|"a[34]"|"a[40];
          } else if($1 == "SSDATA") {
          #split($2,a,",");
          #ssdata = "";
          } else if($1 == "CAMELINFO") {
          split($2,a,",");
          camelinfo=a[6];
          }
          }
          END {

          }

          fstyp -v /dev/vgdbPRD/lvsapdata7
          --------------------------------------------------
          aes04p63[/#]fstyp -v /dev/vgdbPRD/lvsapdata7
          vxfs
          version: 4
          f_bsize: 8192
          f_frsize: 4096
          f_blocks: 30720000
          f_bfree: 14132693
          f_bavail: 13912126
          f_files: 3532944
          f_ffree: 3533168
          f_favail: 3533168
          f_fsid: 1073938446
          f_basetype: vxfs
          f_namemax: 254
          f_magic: a501fcf5
          f_featurebits: 0
          f_flag: 0 <====================注意這里,0表示是一般文件系統,16表示是大文件系統.
          f_fsindex: 7
          f_size: 30720000
          cat /etc/fstab
          共3頁: 1 2 3 下一頁 
          主站蜘蛛池模板: 通榆县| 郸城县| 当涂县| 崇文区| 精河县| 泸溪县| 历史| 犍为县| 崇礼县| 云梦县| 平遥县| 如东县| 霍邱县| 澄迈县| 桃园市| 平和县| 南澳县| 望谟县| 铜梁县| 渝中区| 剑河县| 聊城市| 英德市| 襄樊市| 葫芦岛市| 抚顺县| 城市| 绿春县| 宜春市| 松江区| 白朗县| 潮州市| 富阳市| 贞丰县| 拜泉县| 若尔盖县| 萝北县| 长沙县| 宜川县| 洪洞县| 神农架林区|