06 2017 档案

摘要:一、docker在CentOS 6上的安装 Docker仅支持64位系统,对于centos 6系统可以使用epel库安装docker,命令如下: #yum -y install http://mirrors.yun-idc.com/epel/6/i386/epel-release-6-8.noarc 阅读全文
posted @ 2017-06-30 17:18 ChavinKing 阅读(885) 评论(0) 推荐(0)
摘要:Hive uses log4j for logging. By default logs are not emitted to the console by the CLI. The default logging level is WARN for Hive releases prior to 0 阅读全文
posted @ 2017-06-29 16:11 ChavinKing 阅读(7395) 评论(0) 推荐(0)
摘要:oracle 11.2.0.4 运行以下脚本,使用活动数据库复制技术创建dataguard备库报错rman-005001: run{ duplicate target database for standby from active database spfile set db_unique_nam 阅读全文
posted @ 2017-06-28 18:24 ChavinKing 阅读(1202) 评论(0) 推荐(0)
摘要:1、MovieLens User Ratings First, create a table with tab-delimited text file format: 首先,创建一个通过tab分隔的表: CREATE TABLE u_data ( userid INT, movieid INT, r 阅读全文
posted @ 2017-06-26 23:13 ChavinKing 阅读(320) 评论(0) 推荐(0)
摘要:hive分析nginx日志一:http://www.cnblogs.com/wcwen1990/p/7066230.html hive分析nginx日志二:http://www.cnblogs.com/wcwen1990/p/7074298.html 接着来看: 1、首先编写UDF,如下: --使用 阅读全文
posted @ 2017-06-26 14:09 ChavinKing 阅读(1970) 评论(0) 推荐(0)
摘要:本文继成上一篇通过hive分析nginx日志文章,详情参考下面链接: http://www.cnblogs.com/wcwen1990/p/7066230.html 接着来: 创建业务子表: drop table if exists chavin.nginx_access_log_comm; cre 阅读全文
posted @ 2017-06-24 19:54 ChavinKing 阅读(3515) 评论(0) 推荐(0)
摘要:以下案例是使用hive分析nginx的访问日志案例,其中字段分隔通过正则表达式匹配,具体步骤如下: 日志格式: 192.168.5.139 - - [08/Jun/2017:17:09:12 +0800] "GET //oportal/static/ui/layer/skin/default/ico 阅读全文
posted @ 2017-06-22 17:32 ChavinKing 阅读(1377) 评论(0) 推荐(0)
摘要:编写shell脚本难免遇到需要交互式输入指令的步骤: 方法一: # cat action.sh #!/bin/sh read -p "enter number:" no; read -p "enter number:" name; echo you have entered $no,$name; # 阅读全文
posted @ 2017-06-19 23:25 ChavinKing 阅读(1342) 评论(0) 推荐(0)
摘要:sort命令可以帮助我们对文本文件或stdin输入进行排序,sort通常配合其他命令进行输出操作。uniq是一个经常与sort使用的命令。作用是从文本或stdin读取唯一的行,uniq要求输入必须经过排序。 按数字顺序排序: # sort -n dept 10 ACCOUNTING NEW YORK 阅读全文
posted @ 2017-06-19 22:21 ChavinKing 阅读(295) 评论(0) 推荐(0)
摘要:tr命令用来进行对标准输入的内容做替换。例如 # echo 'HELLO WORLD!!!' | tr "A-Z" "a-z" hello world!!! 这里的"A-Z"、"a-z"都表示集合,shell脚本中定义集合类型很简单,即指定集合序列即可,但是对于上边的情形,不得非输入所有集合类型,可 阅读全文
posted @ 2017-06-19 17:48 ChavinKing 阅读(1235) 评论(0) 推荐(0)
摘要:首先看一下文本信息: # cat text1.txt 1 2 3 4 5 使用xargs格式化一下: # cat text1.txt | xargs 1 2 3 4 5 使用xargs格式化,每两个单词一组: # cat text1.txt | xargs | xargs -n 2 1 2 3 4 阅读全文
posted @ 2017-06-19 11:31 ChavinKing 阅读(2255) 评论(0) 推荐(0)
摘要:find列出目录下所有文件: # find /shell-script/ # find /shell-script/ -print find列出文件夹中所有开头为text的文件,参数-iname意思忽略大小写: # find /shell-script/ -name "text*"# find /s 阅读全文
posted @ 2017-06-18 22:31 ChavinKing 阅读(242) 评论(0) 推荐(0)
摘要:一、分支控制语句 1、if .. fi条件 if condition; then action fi 2、if .. else .. fi条件 if condition;then action; else action fi 3、if .. else if ..else ..fi条件 if cond 阅读全文
posted @ 2017-06-18 18:07 ChavinKing 阅读(660) 评论(0) 推荐(0)
摘要:方法: kill –9 `pgrep java` 使用上述命令可以将服务器上运行的所有java进程一次性kill掉。 扩展:子shell和反应用在shell脚本中的作用 先来看一个子shell的例子: # cat text1.txt 1 2 3 4 5 # text01=$(cat text1.tx 阅读全文
posted @ 2017-06-18 16:48 ChavinKing 阅读(457) 评论(0) 推荐(0)
摘要:测试脚本如下,我这里主要想测试$0,$1,$2,$n,$@,$*默认都代表了什么? #!/bin/sh echo '$1='$1 echo '$2='$2 echo '$@='$@ echo '$*='$* echo '$0='$0 测试: # sh var.sh 1 2 $1=1 $2=2 $@= 阅读全文
posted @ 2017-06-18 16:21 ChavinKing 阅读(185) 评论(0) 推荐(0)
摘要:#!/bin/sh echo -n radio: tput sc #保存当前光标位置 count=0 while true; do if [ $count -lt 10 ];then let count++; sleep 1; #休眠1秒 tput rc; #取出当前光标位置 tput ed #ra 阅读全文
posted @ 2017-06-18 16:04 ChavinKing 阅读(488) 评论(0) 推荐(0)
摘要:stty命令是一个终端处理工具。我们可以通过它来实现静默方式输入密码,脚本如下 #!/bin/sh echo –e “enter password:” stty –echo #禁止将输出发送到终端 read password #交互式读取 stty echo #允许将输出发送到终端 echo pas 阅读全文
posted @ 2017-06-18 15:23 ChavinKing 阅读(1478) 评论(0) 推荐(0)
摘要:脚本内容如下: #!/bin/sh #定义变量 secs=3600unit_time=60 stepts=$(( $secs / $unit_time )) echo CPU usage...; for((i=0;i<stepts;i++))do ps -eo comm,pcpu | tail -n 阅读全文
posted @ 2017-06-17 10:59 ChavinKing 阅读(1250) 评论(0) 推荐(0)
摘要:试验文件: [root@db03 shell-script]# cat text1.txt 1 2 3 4 5 [root@db03 shell-script]# cat text2.txt oracle mysql postgresql hadoop spark 使用paste拼接text1.tx 阅读全文
posted @ 2017-06-16 21:45 ChavinKing 阅读(4173) 评论(0) 推荐(0)
摘要:测试文本内容如下: # cat textfile hadoop hdfs yarn spark zookeeper mapreduce hive hbase scala kafka CHAVIN mysql PostgreSQL mongodb 192.168.100.231 192.168.100 阅读全文
posted @ 2017-06-16 16:31 ChavinKing 阅读(1952) 评论(0) 推荐(0)
摘要:我们知道可以通过工具grep或egrep按行筛选记录,这里我们可以通过cut工具对文本按列进行切分,它可以指定定界符,linux下制表符是默认的定界符。 #cut -f 2,3 textfile 这个命令可以显示textfile文件的第2、3列。 例如:有文件如下: # cat dept 10 AC 阅读全文
posted @ 2017-06-16 16:09 ChavinKing 阅读(3700) 评论(0) 推荐(0)
摘要:find /dbfdumpdir/*full* -mtime +21 -exec rm -rf {} \; 这个shell可以删除目录/dbfdumpdir下面21天前生成的,文件名包含full的文件。其实这个指令是我用来自动删除oracle 测试库中数据泵历史备份文件的脚本。 阅读全文
posted @ 2017-06-16 13:54 ChavinKing 阅读(475) 评论(0) 推荐(0)
摘要:Shell这种脚本语言特点是,结果松散,场景复杂,针对于一些参数都有特殊意义。针对于大部分工程师而言,使用中的情况是你可能会经常忘记参数或其意义,使你不得不查阅man或网上寻求帮助。此篇文档作用就是在自己忘记个别参数的情况下有个一目了然的答案。 一、sed进行文本处理 Linux的sed工具是lin 阅读全文
posted @ 2017-06-16 13:27 ChavinKing 阅读(833) 评论(0) 推荐(0)
摘要:1、分析日志格式如下 . . imported "xxx_330508"."xxx_T_DATA" 46.17 MB 268 rows . . imported "xxx_330508"."xxx_T_CAUSERLOG" 24.74 MB 72246 rows . . imported "xxx_ 阅读全文
posted @ 2017-06-15 21:20 ChavinKing 阅读(378) 评论(0) 推荐(0)
摘要:字符 描述 \ 将下一个字符标记为一个特殊字符、或一个原义字符、或一个向后引用、或一个八进制转义符。例如,“n”匹配字符“n”。“\n”匹配一个换行符。串行“\\”匹配“\”而“\(”则匹配“(”。 ^ 匹配输入字符串的开始位置。如果设置了RegExp对象的Multiline属性,^也匹配“\n”或 阅读全文
posted @ 2017-06-15 15:34 ChavinKing 阅读(235) 评论(0) 推荐(0)
摘要:平时都使用ftp工具进行文件的上传下载操作,针对于小文件的简单传输来说,有下面好的方法: 首先安装rz、sz工具: #yum install lrzsz 上传文件:rz 下载文件:sz 上传文件在shell窗口输入rz回车,在弹出的对话框选择需要上传的文件。 下载linux下的文件使用sz + fi 阅读全文
posted @ 2017-06-15 14:17 ChavinKing 阅读(465) 评论(0) 推荐(0)
摘要:This document describes the installation of PostgreSQL using the source code distribution. (If you are installing a pre-packaged distribution, such as an RPM or Debian package, ignore this do... 阅读全文
posted @ 2017-06-08 14:05 ChavinKing 阅读(1074) 评论(0) 推荐(0)
摘要:准备:主备库版本一致,主从库正常安装软件。 1、主库上设置一个复制使用的账户: mysql> grant replication slave,replicate client on *.* to 'rep1'@'192.168.100.136' identified by 'dbking'; Que 阅读全文
posted @ 2017-06-07 13:25 ChavinKing 阅读(256) 评论(0) 推荐(0)
摘要:mysql从3.23开始提供复制功能,复制指将主库的ddl和dml操作通过binlog文件传送到从库上执行,从而保持主库和从库数据同步。mysql支持一台主库同时向多台从库复制,从库同时也可以作为其他从库的主库,从而实现级联复制功能。mysql复制功能相当于oracle数据库的逻辑dg功能。 mys 阅读全文
posted @ 2017-06-07 13:24 ChavinKing 阅读(1058) 评论(0) 推荐(0)
摘要:一、MySQL日志文件 mysql日志文件及功能: 日志文件 功能 错误日志 记录启动、停止、运行过程中mysqld时出现的问题 通用日志 记录建立客户端连接和执行的语句 二进制日志 记录更改数据的所有语句,还用于复制 慢查询日志 记录执行时间超过long_query_time秒的所有查询 默认情况 阅读全文
posted @ 2017-06-02 11:43 ChavinKing 阅读(2390) 评论(0) 推荐(0)