本篇內(nèi)容介紹了“如何在Kubernetes環(huán)境中配置Spark Executor”的有關(guān)知識(shí),在實(shí)際案例的操作過程中,不少人都會(huì)遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)、網(wǎng)站空間、營銷軟件、網(wǎng)站建設(shè)、岫巖網(wǎng)站維護(hù)、網(wǎng)站推廣。
Spark在執(zhí)行任務(wù)時(shí),需要訪問到Executor的許多端口,而這些端口是隨機(jī)的,又是通過主機(jī)名稱訪問。所以Kubernetes環(huán)境與大數(shù)據(jù)環(huán)境之間難以直接訪問??赏ㄟ^以下配置實(shí)現(xiàn)大數(shù)據(jù)集群訪問到Kubernetes環(huán)境中運(yùn)行的Spark Executor
1、Spark Executor在執(zhí)行時(shí),有許多隨機(jī)端口,在K8S環(huán)境中運(yùn)行時(shí)需要固定其端口,端口的范圍為K8S集群NodePort分配的端口范圍:30000-32767
#driver監(jiān)聽的接口。這用于和executors以及獨(dú)立的master通信(默認(rèn)隨機(jī))spark_driver_port: 30920#driver的文件服務(wù)器監(jiān)聽的端口(默認(rèn)隨機(jī))spark_fileserver_port: 30921#driver的HTTP廣播服務(wù)器監(jiān)聽的端口(默認(rèn)隨機(jī))spark_broadcast_port: 30922#driver的HTTP類服務(wù)器監(jiān)聽的端口(默認(rèn)隨機(jī))spark_replClassServer_port: 30923#塊管理器監(jiān)聽的端口。這些同時(shí)存在于driver和executors(默認(rèn)隨機(jī))spark_blockManager_port: 30924#executor監(jiān)聽的端口。用于與driver通信(默認(rèn)隨機(jī))spark_executor_port: 30925
2、為Spark Executor創(chuàng)建一個(gè)StatefulSet,可以得到一個(gè)DNS域名:$(podname).(headless server name).namespace.svc.cluster.local
apiVersion: apps/v1kind: StatefulSetmetadata:name: my-executor-statefulsetnamespace: [namespace]labels: app: my-executor-statefulsetspec:serviceName: my-executorreplicas: 1selector:matchLabels:app: my-executor-podversion: [version]template:metadata:labels:app: my-executor-podversion: [version]spec:containers: - name: my-executor-pod image: 192.168.0.12:9090/eyes/my-executor-[namespace]:[version]-[ru] imagePullPolicy: Always ports: - containerPort: 5011hostAliases: - hostnames: - hadoop-master01ip: 192.168.0.10 - hostnames: - hadoop-slave02ip: 192.168.0.11
3、為Spark Executor創(chuàng)建一個(gè)NodePort類型的Service,需要配置剛剛第一步配置好的固定端口
apiVersion: v1kind: Servicemetadata:name: my-executor-svcnamespace: [namespace]labels: app: my-executor-podspec:ports: - port: 5011 name: tcp-port protocol: TCP - port: 4040 name: spark-http-port protocol: TCP nodePort: 30028 - port: 30920 name: spark-driver-port protocol: TCP nodePort: 30920 - port: 30921 name: spark-fileserver-port protocol: TCP nodePort: 30921 - port: 30922 name: spark-broadcast-port protocol: TCP nodePort: 30922 - port: 30923 name: spark-eplclassserver-port protocol: TCP nodePort: 30923 - port: 30924 name: spark-blockmanager-port protocol: TCP nodePort: 30924 - port: 30925 name: spark-executor-port protocol: TCP nodePort: 30925selector: app: my-executor-podtype: NodePort
4、在大數(shù)據(jù)環(huán)境的機(jī)器中全部配置hosts為StatefulSet的DNS域名:$(podname).(headless server name).namespace.svc.cluster.local,IP地址設(shè)置為K8S中的任意IP即可
192.168.0.12 my-executor-statefulset-0.my-executor.test2.svc.cluster.local
“如何在Kubernetes環(huán)境中配置Spark Executor”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!