我的工作是这样的:
https://spark.apache.org/docs/latest/running-on-kubernetes.html
下面是驱动程序用于引导集群的代码:
val sparkSession = SparkSession.builder
.master("k8s://https://kubernetes.default.svc:32768")
.appName("test")
.config("spark.driver.host", "sparkrunner-0")
.config("spark.driver.port", "7077")
.config("spark.driver.blockManager.port", "7078")
.config("spark.kubernetes.container.image","spark-alluxio")
.config("fs.alluxio.impl", "alluxio.hadoop.FileSystem")
.config("fs.alluxio-ft.impl", "alluxio.hadoop.FaultTolerantFileSystem")
.getOrCreate
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: sparkrunner
labels:
app: sparkrunner
spec:
selector:
matchLabels:
app: sparkrunner
serviceName: sparkrunner
replicas: 1
template:
metadata:
labels:
app: sparkrunner
spec:
containers:
- name: sparkrunner
image: "rb/sparkrunner:latest"
imagePullPolicy: Never
ports:
- name: application
containerPort: 9100
- name: driver-rpc-port
containerPort: 7077
- name: blockmanager
containerPort: 7078
# Headless service for stable DNS entries of StatefulSet members.
apiVersion: v1
kind: Service
metadata:
name: sparkrunner
spec:
ports:
- name: driver-rpc-port
protocol: TCP
port: 7077
targetPort: 7077
- name: blockmanager
protocol: TCP
port: 7078
targetPort: 7078
clusterIP: None
selector:
app: sparkrunner
---
# Client service for connecting to any spark instance.
apiVersion: v1
kind: Service
metadata:
name: sparkdriver
spec:
type: NodePort
ports:
- name: sparkdriver
port: 9100
selector:
app: sparkrunner
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
20/04/26 20:24:39 INFO SparkContext: Running Spark version 2.4.2
20/04/26 20:24:40 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
20/04/26 20:24:40 INFO SparkContext: Submitted application: test
20/04/26 20:24:40 INFO SecurityManager: Changing view acls to: root
20/04/26 20:24:40 INFO SecurityManager: Changing modify acls to: root
20/04/26 20:24:40 INFO SecurityManager: Changing view acls groups to:
20/04/26 20:24:40 INFO SecurityManager: Changing modify acls groups to:
20/04/26 20:24:40 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(root); groups with view permissions: Set(); users with modify permissions: Set(root); groups with modify permissions: Set()
20/04/26 20:24:41 INFO Utils: Successfully started service 'sparkDriver' on port 7077.
20/04/26 20:24:41 INFO SparkEnv: Registering MapOutputTracker
20/04/26 20:24:41 INFO SparkEnv: Registering BlockManagerMaster
20/04/26 20:24:41 INFO BlockManagerMasterEndpoint: Using org.apache.spark.storage.DefaultTopologyMapper for getting topology information
20/04/26 20:24:41 INFO BlockManagerMasterEndpoint: BlockManagerMasterEndpoint up
20/04/26 20:24:41 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-e8aa33ba-26d2-421d-9957-9cba1c9a3b9f
20/04/26 20:24:41 INFO MemoryStore: MemoryStore started with capacity 1150.2 MB
20/04/26 20:24:41 INFO SparkEnv: Registering OutputCommitCoordinator
20/04/26 20:24:41 INFO Utils: Successfully started service 'SparkUI' on port 4040.
20/04/26 20:24:41 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://sparkrunner-0:4040
20/04/26 20:24:53 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 7078.
20/04/26 20:24:53 INFO NettyBlockTransferService: Server created on sparkrunner-0:7078
20/04/26 20:24:53 INFO BlockManager: Using org.apache.spark.storage.RandomBlockReplicationPolicy for block replication policy
20/04/26 20:24:53 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, sparkrunner-0, 7078, None)
20/04/26 20:24:53 INFO BlockManagerMasterEndpoint: Registering block manager sparkrunner-0:7078 with 1150.2 MB RAM, BlockManagerId(driver, sparkrunner-0, 7078, None)
20/04/26 20:24:53 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, sparkrunner-0, 7078, None)
20/04/26 20:24:53 INFO BlockManager: Initialized BlockManager: BlockManagerId(driver, sparkrunner-0, 7078, None)
20/04/26 20:24:53 WARN WatchConnectionManager: Exec Failure
java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:246)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:166)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at io.fabric8.kubernetes.client.utils.BackwardsCompatibilityInterceptor.intercept(BackwardsCompatibilityInterceptor.java:119)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at io.fabric8.kubernetes.client.utils.ImpersonatorInterceptor.intercept(ImpersonatorInterceptor.java:68)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at io.fabric8.kubernetes.client.utils.HttpClientUtils$2.intercept(HttpClientUtils.java:107)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
经过更多的戳戳,我发现我使用的k8s服务地址不对:
k8s:/https:/kubernetes.default.svc:32768
我从一个kubectl集群信息中得到了这个信息,但是我的minikube实例可能错误地报告了这个信息(或者代理外部信息)。当我用这个代替的时候:
出身背景 我有一个远程托管服务器,它运行java vm,带有多人实时问答游戏的自定义服务器代码。服务器处理配对、房间、大厅等。我还在同一个空间使用Mongo db,其中包含手机问答游戏的所有问题。 这是我第一次尝试这样的项目,虽然我精通Java,但我的mongo技能充其量只是新手。 客户单例 我的服务器包含mongo客户端的静态单例: 注意: Mongo客户端对我来说是新的,我知道未能正确使用连池
使用带有PostgreSQL JDBC驱动程序的PostgreSQL数据库,我遇到了一个有趣的挑战。似乎最新版本的驱动程序9.2在执行日期/时间匹配时使用客户端时区。 null
当在客户机模式下使用spark时(例如,yarn-client),运行驱动程序的本地机器是否直接与运行远程执行器的集群工作节点通信? 如果是,是否意味着如果集群的配置方式是工作节点在集群之外不可见,那么客户机模式将无法工作,并且必须使用集群模式? 谢了!
我试图了解MySQL JDBC驱动程序中的客户端仿真准备语句是如何工作的。 第1部分我在网上读到,对于准备好的语句,关系数据库处理JDBC/SQL查询时涉及四个步骤,它们如下: 分析传入的SQL查询 编译SQL查询 规划/优化数据采集路径 执行优化的查询/获取并返回数据 如果客户端仿真准备好的语句没有往返数据库,那么它如何执行步骤3?还是客户端仿真准备语句的工作方式不同? 第二部分我还做了两个实验
我有一份spark流媒体工作,我正试图由spark-k8运营商提交。我始终保持重启策略。但是,手动删除驱动程序时,驱动程序不会重新启动。我的yaml: Spark版本:2.4.5 apiVersion:“sparkoperator.k8s.io/v1beta2” 我遵循的步骤: 通过kubectl apply-f示例/spark测试创建资源。亚马尔。Pod创建成功。手动删除驱动程序。 预期行为:将
我正在编写一个客户机-服务器应用程序,但在使用命令模式时遇到了问题。在我的程序中,服务器从客户端接收字符串输入命令,在HashMap中为输入找到合适的命令,执行它并返回返回值。我在弄清楚如何编写需要不止一步的命令时遇到了问题(命令必须要求客户机提供额外的参数,然后应该返回最终结果)。 命令界面 服务器与客户端的通信 一步到位,毫无问题 我不知道如何编写一个命令,它需要一个额外的参数来执行,它不能在