Apache Kyuubi (Incubating), une passerelle distribuée et multi-tenant pour servir du SQL sans serveur sur Lakehouse. Cet article est un article d'introduction à Kyuubi. Il présente l'installation et l'utilisation de base de Kyuubi, et utilise le moteur Spark comme exemple pour décrire comment soumettre la première tâche Spark SQL.
Vous pouvez également lire l'article « Analyse comparative complète de Kyuubi et Spark ThriftServer » pour comprendre les similitudes et les différences entre Kyuubi et Spark ThriftServer.
Téléchargement du package d'installation
Accédez à la page suivante pour télécharger le package d'installation de kyuubi : https://kyuubi.apache.org/releases.html . Ce qui suit prend la version 1.5.0 en incubation comme exemple.
mkdir /data && cd /data
wget https://dlcdn.apache.org/incubator/kyuubi/kyuubi-1.5.0-incubating/apache-kyuubi-1.5.0-incubating-bin.tgz
tar zxvf apache-kyuubi-1.5.0-incubating-bin.tgz
ln -s apache-kyuubi-1.5.0-incubating-bin kyuubi
Puisque nous utilisons ici le moteur Spark, nous devons également télécharger le package d’installation Spark.
cd /data
wget https://www.apache.org/dyn/closer.lua/spark/spark-3.2.1/spark-3.2.1-bin-hadoop3.2.tgz
tar zxvf spark-3.2.1-bin-hadoop3.2.tgz
ln -s spark-3.2.1-bin-hadoop3.2 spark
Modifier le fichier de configuration
cd conf
cp spark-env.sh.template spark-env.sh
vim spark-env.sh
Définir HADOOP_CONF_DIR
exporter HADOOP_CONF_DIR=/etc/hadoop/conf
Tester si les tâches Spark peuvent être soumises à Yarn
bin/spark-submit --master yarn --class org.apache.spark.examples.SparkPi ./examples/jars/spark-examples_2.12-3.2.1.jar
Obtenez les résultats suivants
![image4b1012c9f78a5a35.png](https://images.lrting.top/images/2022/04/08/image4b1012c9f78a5a35.png)
Modification du fichier de configuration
Modifier le fichier de configuration
cd /data/kyuubi
cd conf
cp kyuubi-defaults.conf.template kyuubi-defaults.conf
cp kyuubi-env.sh.template kyuubi-env.sh
cp log4j2.properties.template log4j2.properties
Pour les paramètres de configuration des fichiers ci-dessus, veuillez vous référer à : https://kyuubi.apache.org/docs/latest/deployment/settings.html
Ce qui suit prend HDP 3.1.4 comme exemple
Le contenu de kyuubi-env.sh est le suivant
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64
export SPARK_HOME=/data/spark
export HADOOP_CONF_DIR=/etc/hadoop/conf
export KYUUBI_JAVA_OPTS="-Xmx6g -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=4096 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+UseCondCardMark -XX:MaxDirectMemorySize=1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./logs -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -Xloggc:./logs/kyuubi-server-gc-%t.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=5M -XX:NewRatio=3 -XX:MetaspaceSize=512m"
export KYUUBI_BEELINE_OPTS="-Xmx2g -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=4096 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+UseCondCardMark"
Le contenu de kyuubi-defaults.conf est le suivant
kyuubi.ha.zookeeper.quorum hadoop1:2181,hadoop2:2181,hadoop3:2181
spark.master yarn
Le fichier log4j2.properties n'a pas besoin d'être modifié.
Commencer Kyubi
bin/kyuubi start
Vous pouvez voir que Kyuubi a commencé
![image.png](https://images.lrting.top/images/2022/04/08/image.png)
Utilisez Beeline pour vous connecter à Kyuubi
bin/beeline -u "jdbc:hive2://hadoop1:2181,hadoop2:2181,hadoop3:2181/default;serviceDiscoveryMode=zooKeeper;zooKeeperNamespace=kyuubi" -n hdfs
obtenir
![image71c021a5e511db49.png](https://images.lrting.top/images/2022/04/08/image71c021a5e511db49.png)
Voir l'interface utilisateur de YARN
![image2d86a2fdef1e5190.png](https://images.lrting.top/images/2022/04/08/image2d86a2fdef1e5190.png)
Soumettre la tâche de test
![imagea4cb5fceee31522c.png](https://images.lrting.top/images/2022/04/08/imagea4cb5fceee31522c.png)