Session 0x0 for server null,HBase无法启动解决方法
碰到个怪问题,Master上的HMaster服务老是自动死掉, 看错误日志只是提示连接失败Session 0x0 for server null 解决方法: 1. 关闭IP6 , 修改/etc/hosts 注释以"::1 "开头的 2. 校准HBase集群Zookeeper集群机器的时间,误差30秒以内 重启机器.ok
原文:http://tonymomo.pixnet.net/blog/post/62329497
1 package org.apache.hadoop.examples; 2 3 import java.io.File; 4 import java.io.FileInputStream; 5 import java.io.FileOutputStream; 6 import java.io.IOException; 7 import java.net.URL; 8 import java.net.URLClassLoader; 9 import java.util.ArrayList; 10 import java.util.List; 11 import java.util.jar.JarEntry; 12 import java.util.jar.JarOutputStream; 13 import java.util.jar.Manifest; 14 15 public class EJob { 16 17 // To declare global field 18 private static List<URL> classPath = new ArrayList<URL>(); 19 20 // To declare method 21 public static File createTempJar(String root) throws IOException { 22 if (!new File(root).exists()) { 23 return null; 24 } 25 Manifest manifest = new Manifest(); 26 manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); 27 final File jarFile = File.createTempFile("EJob-", ".jar", new File( 28 System.getProperty("java.io.tmpdir"))); 29 30 Runtime.getRuntime().addShutdownHook(new Thread() { 31 public void run() { 32 jarFile.delete(); 33 } 34 }); 35 36 JarOutputStream out = new JarOutputStream( 37 new FileOutputStream(jarFile), manifest); 38 createTempJarInner(out, new File(root), ""); 39 out.flush(); 40 out.close(); 41 return jarFile; 42 } 43 44 private static void createTempJarInner(JarOutputStream out, File f, 45 String base) throws IOException { 46 if (f.isDirectory()) { 47 File[] fl = f.listFiles(); 48 if (base.length() > 0) { 49 base = base + "/"; 50 } 51 for (int i = 0; i < fl.length; i++) { 52 createTempJarInner(out, fl[i], base + fl[i].getName()); 53 } 54 } else { 55 out.putNextEntry(new JarEntry(base)); 56 FileInputStream in = new FileInputStream(f); 57 byte[] buffer = new byte[1024]; 58 int n = in.read(buffer); 59 while (n != -1) { 60 out.write(buffer, 0, n); 61 n = in.read(buffer); 62 } 63 in.close(); 64 } 65 } 66 67 public static ClassLoader getClassLoader() { 68 ClassLoader parent = Thread.currentThread().getContextClassLoader(); 69 if (parent == null) { 70 parent = EJob.class.getClassLoader(); 71 } 72 if (parent == null) { 73 parent = ClassLoader.getSystemClassLoader(); 74 } 75 return new URLClassLoader(classPath.toArray(new URL[0]), parent); 76 } 77 78 public static void addClasspath(String component) { 79 80 if ((component != null) && (component.length() > 0)) { 81 try { 82 File f = new File(component); 83 84 if (f.exists()) { 85 URL key = f.getCanonicalFile().toURL(); 86 if (!classPath.contains(key)) { 87 classPath.add(key); 88 } 89 } 90 } catch (IOException e) { 91 } 92 } 93 } 94 95 }
mian方法中添加:
File jarFile = EJob.createTempJar("bin");
EJob.addClasspath("/usr/hadoop/conf");
ClassLoader classLoader = EJob.getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
。。。
((JobConf) job.getConfiguration()).setJar(jarFile.toString());
如果本文对您有帮助,点一下右下角的“推荐”
微信关注我们
转载内容版权归作者及来源网站所有!
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。
为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。
Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。
Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。