随笔-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 下一页