首页
关于
我的作品
Privacy Policy
Search
1
hive--删除表中的数据truncate
2 阅读
2
【超实用教程】用 SwitchHosts 搭配 GitHub520,一键解决 GitHub 访问慢、图片加载失败问题
2 阅读
3
Oracle SQL Developer连接HiveServer
1 阅读
4
精华 Nano Banana 神指令词!适合懒人! (3D 建模、3D 手办、Q 版旅行地图...)
1 阅读
5
优化网站速度:如何利用Google的PageSpeed Insights提升用户体验和SEO排名
0 阅读
未分类
Kafka
jekyll
hive
java
mine
hadoop
linux
日常
storm
rabbitMq
react-native
luster
pmp
ai
pmi
github
aigc
登录
Search
标签搜索
centos
apache
Kafka
maven
hadoop
idea
zookeeper
rabbitmq
centos7
ssh
插件
hive
继承
hdfs
编译
log4j
java
module
iptables
update
Typecho
累计撰写
36
篇文章
累计收到
45
条评论
首页
栏目
未分类
Kafka
jekyll
hive
java
mine
hadoop
linux
日常
storm
rabbitMq
react-native
luster
pmp
ai
pmi
github
aigc
页面
关于
我的作品
Privacy Policy
搜索到
3
篇与
的结果
2018-05-14
rabbitMq常用创建消息应用的maven demo项目(一)---路由routing
rabbitmq官网上提供了6个demo,分别从是hello world、工作队列、发布/订阅、路由、主题、rpc这六个demo。 基本上看完这6哥demo之后,对rabbitmq应该就有了清晰的认识,并且可以达到基本数量应用的程度。下面我挑选最常用的路由和主题这两个demo,为大家翻译下。个人加谷歌翻译,有不合适的地方,欢迎大家批评指正。Routing---路由在之前的教程中,我们构建了一个简单的日志系统 我们能够将日志消息广播给许多接收者。在本教程中,我们将在他的基础上添加一个功能 - 只订阅一部分消息。例如,我们只将严重错误的消息导入日志文件(以节省磁盘空间),同时仍然能够在控制台上打印所有日志消息。
2018年05月14日
0 阅读
0 评论
0 点赞
2018-05-07
apache storm demo示例
从国外网站上翻译的,主要业务是创建移动电话日志分析器。场景 - 移动呼叫日志分析器移动电话及其持续时间将作为Apache Storm的输入提供,Storm将处理并分组相同呼叫者和接收者之间的呼叫及其呼叫总数。创建SpoutSpout是用于数据生成的组件。基本上,spout将实现一个IRichSpout接口。“IRichSpout”界面有以下重要方法 - open - 为spout提供执行环境。执行者将运行此方法来初始化spout。 nextTuple - 通过收集器发出生成的数据。 close - spout将要关闭时调用此方法。 declareOutputFields - 声明元组的输出模式。 ack - 确认处理了特定的tuple fail - 指定一个特定的tuple不被处理并且不被重新处理。 openopen方法的签名如下 -open(Map conf, TopologyContext context, SpoutOutputCollector collector) conf - 为此spout提供storm暴配置。 context - 提供关于topology中spout位置,其任务ID,输入和输出信息的完整信息。 collector - 使我们能够发出将由bolts处理的tuple。 nextTuplenextTuple方法的签名如下 -nextTuple() nextTuple()从与ack()和fail()方法相同的循环周期性地调用。当没有工作要做时,它必须释放对线程的控制,以便其他方法有机会被调用。所以nextTuple的第一行检查处理是否完成。如果是这样,它应该睡眠至少一毫秒,以在返回之前减少处理器上的负载。
2018年05月07日
0 阅读
0 评论
0 点赞
2017-11-08
Server IPC version 9 cannot communicate with client version 4 hadoop hdfs连接不上
commons-httpclient-3.1.jarcommons-io-2.4.jarcommons-lang-2.6.jarcommons-logging-1.1.3.jarcommons-net-3.1.jarguava-11.0.2.jarhadoop-common-2.6.2.jarhadoop-auth-2.6.2.jarslf4j-api-1.7.5.jarhadoop-hdfs-2.6.2.jarcommons-cli-1.2.jarprotobuf-java-2.5.0.jarhtrace-core-3.0.4.jar在pom.xml中添加这些commons-httpclient-3.1.jar commons-io-2.4.jar commons-lang-2.6.jar commons-logging-1.1.3.jar commons-net-3.1.jar guava-11.0.2.jar hadoop-common-2.6.2.jar hadoop-auth-2.6.2.jar slf4j-api-1.7.5.jar hadoop-hdfs-2.6.2.jar commons-cli-1.2.jar protobuf-java-2.5.0.jar htrace-core-3.0.4.jar 以下为示例代码: /** * @Autohor: liyj * @Description: * @Date:Created in 2017/11/7 * @Modified by : */ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; public class HdfsFileReader { private static final String NAME_NODE = "hdfs://tj02:8020";//nameNomeHost = localhost if you use hadoop in local mode public static void main(String[] args) throws URISyntaxException, IOException { // String fileInHdfs = "/user/hive/warehouse/t001011003"; Configuration configuration = new Configuration(); // configuration.set("fs.hdfs.impl", // org.apache.hadoop.hdfs.DistributedFileSystem.class.getName() // ); // configuration.set("fs.file.impl", // org.apache.hadoop.fs.LocalFileSystem.class.getName() // ); FileSystem fs = FileSystem.get(URI.create(NAME_NODE), configuration); // // fs.createNewFile(new Path("/user/hive/warehouse/t001011003/0000sadasd")); // String fileContent = IOUtils.toString(fs.open(new Path(fileInHdfs)), "UTF-8"); // System.out.println("File content - " + fileContent); // copyFile2Hdfs(); Path listf = new Path("/user/hive/warehouse/t001011003"); FileStatus stats[] = fs.listStatus(listf); for (int i = 0; i < stats.length; ++i) { System.out.println(stats[i].getPath().toString()); } fs.close(); } public static void copyFile2Hdfs() throws IOException { Configuration conf = new Configuration(); FileSystem hdfs = FileSystem.get(conf); //本地文件 // Path src =new Path("D:\\HebutWinOS"); //HDFS为止 Path dst = new Path("/"); // hdfs.copyFromLocalFile(src, dst); System.out.println("Upload to" + conf.get("fs.default.name")); FileStatus files[] = hdfs.listStatus(dst); for (FileStatus file : files) { System.out.println(file.getPath()); } } }
2017年11月08日
0 阅读
0 评论
0 点赞