
# 在Linux中调测Presto应用开发
#### JDBC客户端运行及结果查看
1. 执行mvn clean compile assembly:single生成jar包，在工程目录target目录下获取，比如:presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar。
2. 在运行调测环境上创建一个目录作为运行目录，如或"/opt/presto_examples"(Linux环境)，并在该目录下创建子目录"conf"。 
   将[1]导出的presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar拷贝到"/opt/presto_examples"下。
   
   
3. 开启Kerberos认证集群需要将[4](https://support.huaweicloud.com/devg-mrs/mrs_06_0342.html#mrs_06_0342__li58628918172639)获取的user.keytab和krb5.conf拷贝到的/opt/presto_examples/conf下，并修改样例代码中conf目录下的presto.properties。未开启Kerberos认证集群无需执行此步骤。
   
   表1presto.properties参数说明 
   | 参数                 | 说明                                                                                                         |
   |:---|:---|
   | user               | 用于Kerberos认证的用户名，即[准备Presto应用开发用户](https://support.huaweicloud.com/devg-mrs/mrs_06_0342.html)中创建的开发用户的用户名。 |
   | KerberosPrincipal  | 用于认证的名字，即认证[准备Presto应用开发用户](https://support.huaweicloud.com/devg-mrs/mrs_06_0342.html)中创建的开发用户的用户名。        |
   | KerberosConfigPath | krb5.conf的路径。                                                                                              |
   | KerberosKeytabPath | user.keytab的路径。                                                                                            |
      
   presto.properties样例：
   ```
   user = prestouser
   SSL = true
   KerberosRemoteServiceName = HTTP
   KerberosPrincipal = prestouser
   KerberosConfigPath = /opt/presto_examples/conf/krb5.conf
   KerberosKeytabPath = /opt/presto_examples/conf/user.keytab
   ```
   
   
4. 在Linux环境下执行运行样例程序。 
   ```
   chmod +x /opt/presto_examples -R 
   cd /opt/presto_examples
   java -jar presto-examples-1.0-SNAPSHOT-jar-with-dependencies.jar
   ```
   
   
5. 在命令行终端查看样例代码所查询出的结果。 
   Linux环境运行成功结果会有如下信息：
   ```
   NY Metro : 2
   Mid Atlantic : 6
   Mid Atlantic : 6
   North Midwest : 1
   North Midwest : 3
   North Midwest : 7
   ```
   
   
 
