fsk119 commented on code in PR #20719: URL: https://github.com/apache/flink/pull/20719#discussion_r969132854
########## docs/content.zh/docs/dev/table/sql-gateway/overview.md: ########## @@ -0,0 +1,226 @@ +--- +title: Overview +weight: 1 +type: docs +aliases: +- /dev/table/sql-gateway.html +--- +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +Introduction +---------------- + +The SQL Gateway is a service that enables multiple clients from the remote to execute SQL in concurrency. It provides +an easy way to submit the Flink Job, look up the metadata, and analyze the data online. + +The SQL Gateway is composed of a pluggable Endpoint and the SqlGatewayService. The SqlGatewayService is a processor that is +reused by the endpoints to handle the requests. The endpoint is an entry point that allows users to connect. Depending on the +type of the endpoints, users can be using different utils to connect. + +{{< img width="80%" src="/fig/sql-gateway-architecture.png" alt="SQL Gateway Architecture" >}} + +Getting Started +--------------- + +This section describes how to setup and run your first Flink SQL program from the command-line. + +The SQL Gateway is bundled in the regular Flink distribution and thus runnable out-of-the-box. It requires only a running Flink cluster where table programs can be executed. For more information about setting up a Flink cluster see the [Cluster & Deployment]({{< ref "docs/deployment/resource-providers/standalone/overview" >}}) part. If you simply want to try out the SQL Client, you can also start a local cluster with one worker using the following command: + +```bash +./bin/start-cluster.sh +``` +### Starting the SQL Gateway + +The SQL Gateway scripts are also located in the binary directory of Flink. Users can start by calling: + +```bash +./bin/sql-gateway.sh start -Dsql-gateway.endpoint.rest.bind-address=localhost +``` + +The command starts the SQL Gateway with REST endpoint that listens on the address localhost:8083. You can use the curl command to check +whether the REST endpoint is available. + +```bash +curl http://localhost:8083/v1/info +{"productName":"Apache Flink","version":"1.16-SNAPSHOT"}% +``` + +### Running SQL Queries + +For validating your setup and cluster connection, you can work with following steps. + +**Step 1: Open a session** + +```bash +curl --request POST http://localhost:8083/v1/sessions + +{"sessionHandle":"f120b289-7241-420d-aac7-aff774ea6f0e"}% Review Comment: > This is a zsh feature that prints a percent-and-newline after a command completes if that command does not already include a newline at the end of its output. It seems it may mislead others. I think we can remove this. [1]https://stackoverflow.com/questions/29497038/why-does-a-curl-request-return-a-percent-sign-with-every-request-in-zsh -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org