2016年5月24日星期二

hadoop报错Going to preempt 1 due to lack of space

原因是ResourceManager资源分配不够,修改yarn-site.xml中 yarn.scheduler.minimum-allocation-mb / yarn.scheduler.maximum-allocation-mb / yarn.scheduler.minimum-allocation-vcores / yarn.scheduler.maximum-allocation-vcores 配置不要太大。
Hadoop资源配置参考:http://dongxicheng.org/mapreduce-nextgen/hadoop-yarn-configurations-resourcemanager-nodemanager/

2016年5月11日星期三

Linux文件和文件夹默认权限

文件的默认权限:644
文件夹的默认权限:755

chmod 644 file_name
chmod 755 directory_name

2016年5月10日星期二

CentOS中samba可以看到文件夹但无法写入

参考http://serverfault.com/questions/410806/can-connect-to-samba-but-access-denied-to-homes

执行chcon -t samba_share_t <share_folder>,解决。

如果没有权限访问文件夹,一种可能的原因是samba用户不属于该文件夹所属的用户和组。

2016年5月4日星期三

HBase启动之后没有HRegionServer进程

看了一下日志,是因为master和slave的时间不同步引起的:
2016-05-01 23:18:33,193 ERROR [PriorityRpcServer.handler=14,queue=0,port=16000] master.MasterRpcServices: Region server slave1,16020,1462349077653 reported a fatal error:
ABORTING region server slave1,16020,1462349077653: Unhandled: org.apache.hadoop.hbase.ClockOutOfSyncException: Server slave1,16020,1462349077653 has been rejected; Reported
time is too far out of sync with master.  Time difference of 233170863ms > max allowed of 30000ms

修改时间和网络时间同步保证集群中所有机器的时间都一致即可解决问题。

Windows中设置Java的默认字符集为UTF-8

Java中有出现中文乱码的情况,使用System.out.println(System.getProperty("file.encoding"));查看了系统的文件编码为GBK,将该变量的值设为UTF-8便可以解决问题。

可以在运行程序的时候指定编码,用-Dfile.encoding=UTF-8参数即可。

或者根据Java官方文档http://docs.oracle.com/javase/6/docs/platform/jvmti/jvmti.html#tooloptions在系统环境变量中增加一个变量,变量名为: JAVA_TOOL_OPTIONS, 变量值为:-Dfile.encoding=UTF-8,保存,重新打开ide运行,问题解决。