diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68a740839..010228cee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,8 +34,6 @@ jobs: uses: actions/setup-java@v1 with: java-version: '1.8' - - uses: olegtarasov/get-tag@v2 - id: tagName - name: Make Distribution run: ./build/dist --tgz - name: Create Release @@ -45,7 +43,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} - release_name: Release Kyuubi-${{ steps.tagName.outputs.tag }} + release_name: Release Kyuubi-${{ github.ref }} draft: false prerelease: false - name: Upload Release Asset @@ -53,4 +51,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - asset_paths: '["./kyuubi-*tgz"]' + asset_paths: '["./kyuubi-*tar.gz"]' diff --git a/.gitignore b/.gitignore index 4a74ab8b1..ef7d1d68f 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ embedded_zookeeper/ /externals/kyuubi-spark-sql-engine/spark-warehouse/ /work/ /docs/_build/ +/kyuubi-common/metrics/ +kyuubi-common/kyuubi_operation_logs/ diff --git a/docs/deployment/settings.md b/docs/deployment/settings.md index 5b80451b8..6a13d8f56 100644 --- a/docs/deployment/settings.md +++ b/docs/deployment/settings.md @@ -115,6 +115,13 @@ kyuubi\.delegation
\.token\.gc\.interval|
PT168H
|
unused yet
|
1.0.0
kyuubi\.delegation
\.token\.renew\.interval|
PT168H
|
unused yet
|
1.0.0
+### Engine + +Key | Default | Meaning | Since +--- | --- | --- | --- +kyuubi\.engine\.check
\.interval|
PT10M
|
The check interval for engine timeout
|
1.0.0
+kyuubi\.engine\.idle
\.timeout|
PT30M
|
engine timeout, it will be closed when it's not accessed for this duration
|
1.0.0
+ ### Frontend Key | Default | Meaning | Since @@ -161,11 +168,11 @@ kyuubi\.operation\.idle
\.timeout|
PT5M
|
The check interval for session timeout.
|
+kyuubi\.session\.check
\.interval|
PT5M
|
The check interval for session timeout.
|
1.0.0
kyuubi\.session\.engine
\.initialize\.timeout|
PT1M
|
Timeout for starting the background engine, e.g. SparkSQLEngine.
|
1.0.0
kyuubi\.session\.engine
\.login\.timeout|
PT15S
|
The timeout(ms) of creating the connection to remote sql query engine
|
1.0.0
kyuubi\.session\.engine
\.spark\.main\.resource|
<undefined>
|
The package used to create Spark SQL engine remote application. If it is undefined, Kyuubi will use the default
|
1.0.0
-kyuubi\.session
\.timeout|
PT6H
|
session timeout, it will be closed when it's not accessed for this duration
|
+kyuubi\.session
\.timeout|
PT6H
|
session timeout, it will be closed when it's not accessed for this duration
|
1.0.0
### Zookeeper diff --git a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala index bcd34cf10..d1072e3f6 100644 --- a/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala +++ b/kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala @@ -351,31 +351,30 @@ object KyuubiConf { .timeConf .createWithDefault(Duration.ofSeconds(60).toMillis) - val SESSION_CHECK_INTERVAL: ConfigEntry[Long] = - buildConf("session.check.interval") - .doc("The check interval for session timeout.") - .timeConf - .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") - .createWithDefault(Duration.ofMinutes(5).toMillis) + val SESSION_CHECK_INTERVAL: ConfigEntry[Long] = buildConf("session.check.interval") + .doc("The check interval for session timeout.") + .version("1.0.0") + .timeConf + .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") + .createWithDefault(Duration.ofMinutes(5).toMillis) - val SESSION_TIMEOUT: ConfigEntry[Long] = - buildConf("session.timeout") - .doc("session timeout, it will be closed when it's not accessed for this duration") - .timeConf - .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") - .createWithDefault(Duration.ofHours(6).toMillis) + val SESSION_TIMEOUT: ConfigEntry[Long] = buildConf("session.timeout") + .doc("session timeout, it will be closed when it's not accessed for this duration") + .version("1.0.0") + .timeConf + .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") + .createWithDefault(Duration.ofHours(6).toMillis) - val ENGINE_CHECK_INTERVAL: ConfigEntry[Long] = - buildConf("engine.check.interval") - .doc("The check interval for engine timeout") - .timeConf - .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") - .createWithDefault(Duration.ofMinutes(10).toMillis) - - val ENGINE_IDLE_TIMEOUT: ConfigEntry[Long] = - buildConf("engine.idle.timeout") - .doc("engine timeout, it will be closed when it's not accessed for this duration") - .timeConf - .createWithDefault(Duration.ofMinutes(30L).toMillis) + val ENGINE_CHECK_INTERVAL: ConfigEntry[Long] = buildConf("engine.check.interval") + .doc("The check interval for engine timeout") + .version("1.0.0") + .timeConf + .checkValue(_ > Duration.ofSeconds(3).toMillis, "Minimum 3 seconds") + .createWithDefault(Duration.ofMinutes(10).toMillis) + val ENGINE_IDLE_TIMEOUT: ConfigEntry[Long] = buildConf("engine.idle.timeout") + .doc("engine timeout, it will be closed when it's not accessed for this duration") + .version("1.0.0") + .timeConf + .createWithDefault(Duration.ofMinutes(30L).toMillis) } diff --git a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala index 17d767374..8d146158e 100644 --- a/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala +++ b/kyuubi-ha/src/main/scala/org/apache/kyuubi/ha/client/ServiceDiscovery.scala @@ -224,18 +224,20 @@ object ServiceDiscovery { */ @throws[Exception] def setUpZooKeeperAuth(conf: KyuubiConf): Unit = { - val keyTabFile = conf.get(KyuubiConf.SERVER_KEYTAB) - val maybePrincipal = conf.get(KyuubiConf.SERVER_PRINCIPAL) - val kerberized = maybePrincipal.isDefined && keyTabFile.isDefined - if (UserGroupInformation.isSecurityEnabled && kerberized) { - if (!new File(keyTabFile.get).exists()) { - throw new IOException(s"${KyuubiConf.SERVER_KEYTAB.key} does not exists") + if (conf.get(HA_ZK_ACL_ENABLED)) { + val keyTabFile = conf.get(KyuubiConf.SERVER_KEYTAB) + val maybePrincipal = conf.get(KyuubiConf.SERVER_PRINCIPAL) + val kerberized = maybePrincipal.isDefined && keyTabFile.isDefined + if (UserGroupInformation.isSecurityEnabled && kerberized) { + if (!new File(keyTabFile.get).exists()) { + throw new IOException(s"${KyuubiConf.SERVER_KEYTAB.key} does not exists") + } + System.setProperty("zookeeper.sasl.clientconfig", "KyuubiZooKeeperClient") + var principal = maybePrincipal.get + principal = SecurityUtil.getServerPrincipal(principal, "0.0.0.0") + val jaasConf = new JaasConfiguration("KyuubiZooKeeperClient", principal, keyTabFile.get) + Configuration.setConfiguration(jaasConf) } - System.setProperty("zookeeper.sasl.clientconfig", "KyuubiZooKeeperClient") - var principal = maybePrincipal.get - principal = SecurityUtil.getServerPrincipal(principal, "0.0.0.0") - val jaasConf = new JaasConfiguration("KyuubiZooKeeperClient", principal, keyTabFile.get) - Configuration.setConfiguration(jaasConf) } } } diff --git a/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/ServiceDiscoverySuite.scala b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/ServiceDiscoverySuite.scala index f0d0fa571..0b354e9d3 100644 --- a/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/ServiceDiscoverySuite.scala +++ b/kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/ServiceDiscoverySuite.scala @@ -27,6 +27,7 @@ import org.apache.zookeeper.ZooDefs import org.apache.kyuubi.{KerberizedTestHelper, KYUUBI_VERSION} import org.apache.kyuubi.config.KyuubiConf +import org.apache.kyuubi.ha.HighAvailabilityConf import org.apache.kyuubi.ha.HighAvailabilityConf._ import org.apache.kyuubi.ha.server.EmbeddedZkServer import org.apache.kyuubi.service.{NoopServer, Serverable, ServiceState} @@ -50,31 +51,6 @@ class ServiceDiscoverySuite extends KerberizedTestHelper { super.afterAll() } - test("set up zookeeper auth") { - tryWithSecurityEnabled { - val keytab = File.createTempFile("kentyao", ".keytab") - val principal = "kentyao/_HOST@apache.org" - - conf.set(KyuubiConf.SERVER_KEYTAB, keytab.getCanonicalPath) - conf.set(KyuubiConf.SERVER_PRINCIPAL, principal) - - ServiceDiscovery.setUpZooKeeperAuth(conf) - val configuration = Configuration.getConfiguration - val entries = configuration.getAppConfigurationEntry("KyuubiZooKeeperClient") - - assert(entries.head.getLoginModuleName === "com.sun.security.auth.module.Krb5LoginModule") - val options = entries.head.getOptions.asScala.toMap - - assert(options("principal") === - s"kentyao/${InetAddress.getLocalHost.getCanonicalHostName}@apache.org") - assert(options("useKeyTab").toString.toBoolean) - - conf.set(KyuubiConf.SERVER_KEYTAB, keytab.getName) - val e = intercept[IOException](ServiceDiscovery.setUpZooKeeperAuth(conf)) - assert(e.getMessage === s"${KyuubiConf.SERVER_KEYTAB.key} does not exists") - } - } - test("publish instance to embedded zookeeper server") { conf @@ -126,4 +102,30 @@ class ServiceDiscoverySuite extends KerberizedTestHelper { expected.addAll(ZooDefs.Ids.CREATOR_ALL_ACL) assert(acl1 === expected) } + + test("set up zookeeper auth") { + tryWithSecurityEnabled { + val keytab = File.createTempFile("kentyao", ".keytab") + val principal = "kentyao/_HOST@apache.org" + + conf.set(KyuubiConf.SERVER_KEYTAB, keytab.getCanonicalPath) + conf.set(KyuubiConf.SERVER_PRINCIPAL, principal) + conf.set(HighAvailabilityConf.HA_ZK_ACL_ENABLED, true) + + ServiceDiscovery.setUpZooKeeperAuth(conf) + val configuration = Configuration.getConfiguration + val entries = configuration.getAppConfigurationEntry("KyuubiZooKeeperClient") + + assert(entries.head.getLoginModuleName === "com.sun.security.auth.module.Krb5LoginModule") + val options = entries.head.getOptions.asScala.toMap + + assert(options("principal") === + s"kentyao/${InetAddress.getLocalHost.getCanonicalHostName}@apache.org") + assert(options("useKeyTab").toString.toBoolean) + + conf.set(KyuubiConf.SERVER_KEYTAB, keytab.getName) + val e = intercept[IOException](ServiceDiscovery.setUpZooKeeperAuth(conf)) + assert(e.getMessage === s"${KyuubiConf.SERVER_KEYTAB.key} does not exists") + } + } } diff --git a/kyuubi-main/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala b/kyuubi-main/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala index 03024cb04..e6887ced4 100644 --- a/kyuubi-main/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala +++ b/kyuubi-main/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala @@ -90,6 +90,7 @@ class KyuubiSessionImpl( case None => val builder = new SparkProcessBuilder(user, sessionConf.toSparkPrefixedConf) val process = builder.start + info(s"Launching SQL engine: $builder") var sh = getServerHost val started = System.currentTimeMillis() while (sh.isEmpty) { @@ -98,7 +99,7 @@ class KyuubiSessionImpl( } if (started + timeout <= System.currentTimeMillis()) { process.destroyForcibly() - throw KyuubiSQLException(s"Timed out($timeout ms) to launched Spark") + throw KyuubiSQLException(s"Timed out($timeout ms) to launched Spark with $builder") } sh = getServerHost }