kudu ERROR Connection: unexpected exception from downstream 你的主机中的软件中止了一个已建立的连接。

ERROR Connection: [peer master-192.168.43.24:7051(192.168.43.24:7051)] unexpected exception from downstream on [id: 0xf0ee631f, /192.168.43.23:57841 => /192.168.43.24:7051]
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
	at sun.nio.ch.SocketDispatcher.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
	at sun.nio.ch.IOUtil.read(IOUtil.java:192)
	at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
	at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:64)
	at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
	at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
	at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
	at org.apache.kudu.shaded.org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
	at org.apache.kudu.shaded.org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
	at org.apache.kudu.shaded.org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

操作系统是win10

用kudu-client 尝试与 kudu服务器建立连接

http://192.168.43.24:8050/logs      查看kudu 服务端的日志

 W1205 11:49:39.814076 44804 heartbeater.cc:587] Failed to heartbeat to hadoop000:7051: Network error: Failed to ping master at hadoop000:7051: Client connection negotiation failed: client connection to 192.168.43.24:7051: connect: Connection refused (error 111)

ping 主机 hadoop000:7051 失败

解决方案:

修改 win10 的 etc/hosts 文件

C:\Windows\System32\drivers\etc\hosts

加上  192.168.43.24   hadoop000

 kudu ERROR Connection: unexpected exception from downstream 你的主机中的软件中止了一个已建立的连接。_第1张图片

 

package com.imooc.bigdata.course07

import java.util

import org.apache.kudu.client.{CreateTableOptions, KuduClient}
import org.apache.kudu.{ColumnSchema, Schema, Type}

/**
 * @date: 2019/12/4 9:16 
*/ object KuduAPIApp { def main(args: Array[String]): Unit = { //机器名字或者IP都可以 val KUDU_MASTERS = "192.168.43.24" val kuduClient: KuduClient = new KuduClient.KuduClientBuilder(KUDU_MASTERS).build() val tableName = "pk" createTable(kuduClient,tableName) kuduClient.close() } /** * 创建表 * @param kuduClient * @param tableName */ def createTable(kuduClient: KuduClient, tableName: String): Unit = { import scala.collection.JavaConverters._ val columns: util.List[ColumnSchema] = List( new ColumnSchema.ColumnSchemaBuilder("word", Type.STRING).key(true).build(), new ColumnSchema.ColumnSchemaBuilder("count", Type.INT16).build() ).asJava val schema = new Schema(columns) val options : CreateTableOptions = new CreateTableOptions() options.setNumReplicas(1) val parcols: util.LinkedList[String] = new util.LinkedList[String]() parcols.add("word") options.addHashPartitions(parcols,3) kuduClient.createTable(tableName,schema,options) } }

代码可以正常运行,没有报错

你可能感兴趣的:(kudu,scala,kudu,/etc/hosts)