04 2018 档案

摘要:3台虚拟机都是20G磁盘,用着用着发现不够了,先扩容了一台,各种百度...各种坑,每个人的情况不一样,发现不一样的地方最后立即百度查看。一台扩容成功后,打算再扩容一台,目的是留一个记录。(我是用xshell超级用户链接的的虚拟机) 扩容大致分为3步:1.外部设置;2.设置分区;3.重启;4挂载;(挂 阅读全文
posted @ 2018-04-28 14:47 bioamin 阅读(1007) 评论(0) 推荐(0)
摘要:import matplotlib import matplotlib.pyplot as plt fig=plt.figure() #交互式测试,此时报错 解决办法,在引用后添加下面这一行 matplotlib.use('Agg') 例如 import matplotlib matplotlib. 阅读全文
posted @ 2018-04-27 17:04 bioamin 阅读(5264) 评论(0) 推荐(0)
摘要:1..安装Development Tools yum groupinstall -y 'development tools' 2.安装SSL、bz2、zlib来为Python的安装做好准备工作 yum install -y zlib-devel bzip2-devel openssl-devel x 阅读全文
posted @ 2018-04-26 21:12 bioamin 阅读(1666) 评论(0) 推荐(0)
摘要:找不大 eth0网卡,也就连不上网络,症状是ifconfig以后只现实lo,不显示eth0 ifconfig,显示的ip是ifcfg-lo的ip 解决办法 1. 拷贝cp ifcfg-lo ifcfg-eth0 2. 重新配置ifcfg-eth0如下 DEVICE="eth0" BOOTPROTO= 阅读全文
posted @ 2018-04-19 00:57 bioamin 阅读(2434) 评论(0) 推荐(0)
摘要:ip定位数据大约12M,采用-chacheFile 分发 文件来源https://pan.baidu.com/s/1J0pwTafHgt4T0k3vV_gC-A 格式大致格式如下: 0.0.0.0 0.255.255.255 NULL IANA保留地址 NULL 1.0.0.0 1.0.0.255 阅读全文
posted @ 2018-04-16 20:23 bioamin 阅读(718) 评论(0) 推荐(0)
摘要:# 数字 ==> ip # 数字范围[0, 255^4] >>> num2ip = lambda x: '.'.join([str(x/(256**i)%256) for i in range(3,-1,-1)]) >>> num2ip(3232235521) '192.168.0.1' # ip ==> 数字 >>> ip2num = lambda x:sum([256**j*int(i)... 阅读全文
posted @ 2018-04-16 19:10 bioamin 阅读(626) 评论(0) 推荐(0)
摘要:最近开发学习Pyton,当加入中文注释时,运行程序报错: File "red.py", line 10 SyntaxError: Non-ASCII character '\xe5' in file red.py on line 10, but no encoding declared; see h 阅读全文
posted @ 2018-04-16 15:53 bioamin 阅读(15615) 评论(0) 推荐(0)
摘要:sort -k1 -n 第一列按数字正排序 sort -K1 -rn 第一列按数字倒排序 阅读全文
posted @ 2018-04-13 20:58 bioamin 阅读(273) 评论(0) 推荐(0)
摘要:a.txt、b.txt文件如下: a.txt 1 hadoop 3 hadoop 5 hadoop 7 hadoop 9 hadoop 11 hadoop 13 hadoop 15 hadoop 17 hadoop 19 hadoop 21 hadoop 23 hadoop 25 hadoop 27 阅读全文
posted @ 2018-04-13 20:54 bioamin 阅读(2285) 评论(0) 推荐(0)
摘要:二次排序 在Hadoop中,默认情况下是按照key进行排序,如果要按照value进行排序怎么办?即:对于同一个key,reduce函数接收到的value list是按照value排序的。这种应用需求在join操作中很常见,比如,希望相同的key中,小表对应的value排在前面。有两种方法进行二次排序 阅读全文
posted @ 2018-04-13 18:27 bioamin 阅读(1076) 评论(0) 推荐(0)
摘要:然后保存退出 source ~/.bashrc 或者关机重新启动即可 阅读全文
posted @ 2018-04-13 16:40 bioamin 阅读(568) 评论(0) 推荐(0)
摘要:压缩 tar cvzf w.tar.gz xxx1 xxx2 对应解压:tar xvzf w.tar.gz 阅读全文
posted @ 2018-04-13 16:11 bioamin 阅读(221) 评论(0) 推荐(0)
摘要:cat file | grep -c 'xxx' 统计xxx在file中出现的行数 cat file | grep -o 'xxx' 统计xxx在file中出现的次数 阅读全文
posted @ 2018-04-13 16:05 bioamin 阅读(3932) 评论(0) 推荐(0)
摘要:用vim时,想高亮显示一个单词并查找的方发,将光标移动到所找单词. 1: shift + "*" 向下查找并高亮显示 2: shift + "#" 向上查找并高亮显示 3: "g" + "d" 高亮显示光标所属单词,"n" 查找! 阅读全文
posted @ 2018-04-12 16:19 bioamin 阅读(1400) 评论(0) 推荐(0)
摘要:1.随机数(0-100)产生: import random print int(random.random()*100) 2.numpy包中常用的函数: shape函数返回数组每一个维度的长度 #用法a.shapea.shape[0]a.shape[1] tile()主要用于数组的重复,生成新数组 阅读全文
posted @ 2018-04-12 15:52 bioamin 阅读(192) 评论(0) 推荐(0)
摘要:-cacheArchive也是从hdfs上进分发,但是分发文件是一个压缩包,压缩包内可能会包含多层目录多个文件 1.The_Man_of_Property.txt文件如下(将其上传至hdfs上) hadoop fs -put The_Man_of_Property.txt /mapreduce Pr 阅读全文
posted @ 2018-04-03 23:24 bioamin 阅读(972) 评论(0) 推荐(0)
摘要:hadoop命令分为2级,在linux命令行中输入hadoop,会提示输入规则 Usage: hadoop [--config confdir] COMMAND where COMMAND is one of: namenode -format format the DFS filesystem#这 阅读全文
posted @ 2018-04-03 19:51 bioamin 阅读(6466) 评论(0) 推荐(0)
摘要:-cacheFile 分发,文件事先上传至Hdfs上,分发的是一个文件 1.找一篇文章The_Man_of_Property.txt: He was proud of him! He could not but feel that in similar circumstances he himsel 阅读全文
posted @ 2018-04-03 16:45 bioamin 阅读(516) 评论(0) 推荐(0)
摘要:1.冒泡排序(从大到小):交换发生在内部循环 稳定的排序 冒泡排序的平均时间复杂度是O(n2),最好的时间复杂度是O(n),最坏的时间复杂度是O(n2),空间复杂度为O(1) 冒泡排序的优化在于didswap变量 ,通过这个变量的设置,实现冒泡排序的最好时间复杂度是O(n) #!usr/bin/py 阅读全文
posted @ 2018-04-03 00:25 bioamin 阅读(692) 评论(0) 推荐(0)
摘要:统计某几个词在文章出现的次数 -file参数分发,是从客户端分发到各个执行mapreduce端的机器上 1.找一篇文章The_Man_of_Property.txt如下: He was proud of him! He could not but feel that in similar circu 阅读全文
posted @ 2018-04-02 21:50 bioamin 阅读(544) 评论(0) 推荐(0)