Author Archives: Huang Shiyang

新旧MapReduce 的API对比

Hadoop 的版本0.20包含一个新的java MapReduce API,我们也称他为上下文对象(context... Read More | Share it now!

线程池实例:使用Executors和ThreadPoolExecutor

线程池负责管理工作线程,包含一个等待执行的任务队列。线程池的任务队列是一个Runnable集合,工作线程负责从任务队列中取出并执行Runnable对象。 java.util.concurrent.executors 提供了 java.util.concurrent.executor 接口的一个Java实现,可以创建线程池。下面是一个简单示例: 首先创建一个Runable... Read More | Share it now!

Windows 怎样 查看端口号 关闭端口号

1》:方法一   1.Cmd  输入 netstat -a -n -o   2.例如我查80端口被什么占用了   对应的进程pid是  3600 3.再输入tasklist来查看 pid 3600是哪个进程什么程序在跑,可以很快看到是tomcat6在用pid 3600... Read More | Share it now!

Change a server’s hostname in CentOS

By default, your server is started with the server’s given name as the hostname. Some software, such as cPanel, requires a valid Fully Qualified Domain Name (FQDN) for the hostname to be used during their licensing verification system. This article... Read More | Share it now!

linux下passwd命令设置修改用户密码

1、passwd 简单说明; 我们已经学会如何添加用户了,所以我们还要学习设置或修改用户的密码;passwd命令的用法也很多,我们只选如下的几个参数加以说明;想了解更多,请参考man... Read More | Share it now!

解决Linux中出现Too many open files

Too many open files 问题出现有两种情况: 一种是在搜索的时候出现,多半是由于索引创建完毕之后被移动过,如果创建索引的时候不出现该错误,搜索的时候也一般是不会出现的。如果出现了,有两种处理办法,一种是修改合并因子和最小合并因子,并且使用 IndexWriter.Optimize() 优化索引,这样会将索引文件数量减少到文件系统限制之内;另外一种办法是修改操作系统的打开文件数量限制。方法如下: 1. 按照最大打开文件数量的需求设置系统, 并且通过检查/proc/sys/fs/file-max文件来确认最大打开文件数已经被正确设置。 # cat /proc/sys/fs/file-max 如果设置值太小, 修改文件/etc/sysctl.conf的变量到合适的值。 这样会在每次重启之后生效。 如果设置值够大,跳过下步。 # echo 2048 > /proc/sys/fs/file-max 编辑文件/etc/sysctl.conf,插入下行。 fs.file-max = 8192 ... Read More | Share it now!

java设置一段代码执行的超时时间的简单方法 间接实现获取Connection超时问题

HBase未启动时会持续重试,设置超时来kill掉防止浪费太多时间。 http://alantong08.iteye.com/blog/1646908 java早已经给我们提供了解决方案。jdk1.5自带的并发库中Future类就能满足这个需求。Future类中重要方法包括get()和cancel()。get()获取数据对象,如果数据没有加载,就会阻塞直到取到数据,而... Read More | Share it now!

Exception in thread “main” java.lang.IllegalArgumentException: Not a host:port pair:

...... 380 INFO zookeeper.ZooKeeper - Initiating client connection, connectString=hdp1.dg:2181 sessionTimeout=180000 watcher=hconnection 431 INFO zookeeper.ClientCnxn - Opening socket connection to server hdp1.dg/192.168.6.228:2181 441 INFO... Read More | Share it now!

python升级导致yum命令无法使用的解决办法(修改版)

1、报错信息: There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named yum Please install a package which provides this module, or verify that the module is... Read More | Share it now!

Change IP address of a Hadoop HDFS data node server and avoid Block pool errors

CHANGE HOST IP IN CLOUDERA MANAGER Change Host IP on all node sudo nano /etc/hosts Edit the ip cloudera config.ini on all node if the master node ip changes sudo nano /etc/cloudera-scm-agent/config.ini Change IP in PostgreSQL Database For the... Read More | Share it now!