<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hasan Ahmadkhani on Medium]]></title>
        <description><![CDATA[Stories by Hasan Ahmadkhani on Medium]]></description>
        <link>https://medium.com/@hasanahmadkhani?source=rss-32cdd7f44a08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Tw77u1Nqy5iEXh9xmS2Ckw.jpeg</url>
            <title>Stories by Hasan Ahmadkhani on Medium</title>
            <link>https://medium.com/@hasanahmadkhani?source=rss-32cdd7f44a08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:21:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hasanahmadkhani/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build Apache Ranger 2.1 in CentOS/Rocky/RHEL]]></title>
            <link>https://hasanahmadkhani.medium.com/how-build-apache-ranger-2-1-in-centos-rocky-rhel-e0656823c016?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0656823c016</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[apache-ranger]]></category>
            <category><![CDATA[apache-hadoop]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Wed, 27 Apr 2022 11:14:04 GMT</pubDate>
            <atom:updated>2022-04-27T11:15:52.169Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article we will describe how to build Apache Ranger 2.1 in CentOS/Rocky/RHEL/Oracle Linux.</p><p>Finally we will describe notes that we must consider for building Ranger 2.1 for Trino 350+.</p><p>As you can find in Ranger 2.1 pom.xml, this version of Ranger supports Hadoop 3.1.1, Hive 3.1.2 and also Java 8 and Maven 3.6.2.</p><p><strong>Operations Steps:</strong></p><ol><li>Install Java 8 and set PATH</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7021b5ae10e64526bc015340de08c874/href">https://medium.com/media/7021b5ae10e64526bc015340de08c874/href</a></iframe><ol><li>yum group install “Development Tools”</li><li>Install Maven 3.6.2</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3136e7e4b6a408f156121171ba26d92c/href">https://medium.com/media/3136e7e4b6a408f156121171ba26d92c/href</a></iframe><p>4. yum install git -y</p><p>5. Install Python3</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64356bffbc536b2dfe4b591931489be7/href">https://medium.com/media/64356bffbc536b2dfe4b591931489be7/href</a></iframe><p>6. cd /opt</p><p>7. wget <a href="https://downloads.apache.org/ranger/2.1.0/apache-ranger-2.1.0.tar.gz">https://downloads.apache.org/ranger/2.1.0/apache-ranger-2.1.0.tar.gz</a></p><p>8. tar -xzf apache-ranger-2.1.0.tar.gz</p><p>9. if you want, it is possible to change components versions in pom.xml in this step, for example if you want to change PrestoSQL version from 333 to 334 or something like this.</p><p>10. Build with shell</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7308f9609e8ac75c1dc32e3bda82dc1/href">https://medium.com/media/f7308f9609e8ac75c1dc32e3bda82dc1/href</a></iframe><p>In step 10, instead of building in shell you create new project from existing source in intelliJ IDEA and use this IDEA to build Ranger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oPc1SbRVg3r50Op4ioxUcg.png" /></figure><p>If you want to build Ranger 2.1 for PrestoSQL 340–350 you must use Java 11 for build process, refer to step1. and if you want to build Ranger 2.1 for Trino 350+ must be consider from this version PrestoSQL renamed to Trino and package name must be updated in plugin source code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xPE_2fKzzNpZNZyx53WPZA.png" /></figure><p>After build success, in target directory you can find packages. first it’s required to install Ranger admin and user sync services and as per requirement you can configure and install plugins from corresponding servers.</p><p>If you want to download Ranger admin and some of plugins that builds during this article you can download form below link:</p><p><a href="https://github.com/hassanahmadkhani/ApacheRangerBuild">Download Apache Ranger 2.1 — packages</a></p><p><strong>Conclusion</strong>:</p><p>In this article we described how to build Ranger and and during build it’s important to consider maven and Java versions and also if required we can change components/plugin versions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0656823c016" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zeppelin Impersonation in JDBC Connection to Trino/PrestoSQL]]></title>
            <link>https://hasanahmadkhani.medium.com/zeppelin-impersonation-in-jdbc-connection-to-trino-prestosql-9ed1e564086c?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ed1e564086c</guid>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 11:48:17 GMT</pubDate>
            <atom:updated>2022-04-19T11:48:17.159Z</atom:updated>
            <content:encoded><![CDATA[<p>When we want to connect Zeppelin to Trino and authentication is enabled in Zeppelin, it’s required to define a interpreter for all users, its required to specify a user and password for authentication through Trino. also for this scenario we required a user that have impersonation permission to all users in Trino/PrestoSQL and set this static user and password in interpreter and also set sessionUser parameter in connection as impersonation parameter for Trino.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*h5qROgkk4c5BnI2_XWJUyg.png" /></figure><p>For more information about impersonation in Trino and how to configure JDBC interpreter in Zeppelin for Trino please follow this two articles:</p><ul><li><a href="https://hasanahmadkhani.medium.com/file-base-access-control-for-trino-prestosql-4ca9c52c78c">File Base Access Control for Trino/PrestoSQL</a></li><li><a href="https://hasanahmadkhani.medium.com/zeppelin-to-trino-jdbc-connection-driver-problem-5163a584e7a2">Zeppelin to Trino JDBC Connection- Driver Problem</a></li></ul><p>The below SS shows how to configure interpreter, we have two user in zeppelin, admin and hasan, hasan have not access to change interpreter setting. After login to zeppelin user name will sent to Trino as session User parameter with #{user} and Trino will do authorization base on session user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zka-_XCC5yeu1I7PnQ2pQ.png" /></figure><p>Another important thing is that because Zeppelin uses connection pooling mechanism, if we create this interpreter global, first time that a user start using interpreter connections in pool will create and other users will use connections from pool and in Trino side sesionUser maybe be invalid. also it is required to change scope of interpreter to Per User:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*p2V-e5f2R26QtsgAyTDN9Q.png" /></figure><p>Test with admin user, admin user have access two flight and alight2 tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Duq8WxAwbRFxX-g2lD5Xxg.png" /></figure><p>And test with hasan user, re login with hasan user to Zeppelin, hasan can query two field from flight table, can not query flight2 and “origin_country_name” masked for this user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtGOWJyj6UHl0R_NF7qtJw.png" /></figure><p><strong>Conclusion</strong>:</p><p>For impersonation from Zeppelin to Trino we required using sessionUser in connection parameters and also must have a user that have impersonation permission in Trino/PrestoSQL. Also scope of interpreter must be per user or disable connection pooling in Zeppelin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ed1e564086c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File Base Access Control for Trino/PrestoSQL]]></title>
            <link>https://hasanahmadkhani.medium.com/file-base-access-control-for-trino-prestosql-4ca9c52c78c?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ca9c52c78c</guid>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Tue, 19 Apr 2022 11:04:47 GMT</pubDate>
            <atom:updated>2022-04-25T05:37:31.899Z</atom:updated>
            <content:encoded><![CDATA[<p>From PrestoSQL 333 we can manage Presto authorizations with Ranger 2.1, but if we want to mange PrestoSQL/Trino authorization with build-in features without Ranger, it’s possible with file based access control feature that exists in Trino.</p><p>For enabling authorization in Trino/PrestoSQL it’s required to enable authentication and also enable SSL for coordinator. for how to, you can see this article : <a href="https://hasanahmadkhani.medium.com/enable-prestosql-trino-password-file-authentication-e70e544c83d9">https://hasanahmadkhani.medium.com/enable-prestosql-trino-password-file-authentication-e70e544c83d9</a></p><p><strong>Manage ACL with Build-in Features</strong></p><p>First in Trino_installation_dir/etc create a file with name access-control.properties, ACLc will manage in rules.json file and any change in this file automatically will refresh after 30 second.</p><p><strong>vim etc/access-control.properties</strong></p><p>access-control.name=file<br>security.config-file=etc/rules.json<br>security.refresh-period=30s</p><p>Then create a file in rino_installation_dir/etc with name rules.json</p><p>Trino ACLs are in JSON file format. in Trino ACLs we can control below types of permissions:</p><p>Catalog Level<br>Schema Level<br>Table Level<br>Column Level<br>Row Level<br>Masking of Column<br>Query Level<br>Impersonation Level<br>Principal Level</p><p>In this article we are using <strong>Trino 355</strong>. in this version all of the above rules can be manage, but if are using PrestoDB, in latest PrestoDB only “catalogs”, “schema” ,”principal” are available and in PrestoSQL 328 and 333 “catalogs”, “impersonation”, “principals”, “queries” can be mange in ACLs and in Trino 355 all mentioned levels are available.</p><p>We have two user (admin , hasan)and we want to to mange ACL with JSON file, Note: all of rules file content must be in lower case format, Trino can not detect columns name and … in upper case format. this not raise error but do not works correctly. also if we have problem in JSON file structure Trino will not start.</p><p>Also we have six table in hive meta store.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*UgVUQ93edseXS7y7Jd3EQQ.png" /></figure><p>Rules condition:</p><p>admin user have access to all tables in hive catalog,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/1*vFEyyFmpk9MIkwbqXRELKg.png" /></figure><p>admin user have permission to impersonate himself as another user(all users) with sessionUser connection parameter, it is also required when we want to use Zeppelin as JDBC tools and in interpreter we want to admin user cam impersonate as all users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*0n6GiJs0Sa5FS7ZDQL_beg.png" /></figure><p>admin user also can view and kill all users queries in Trino UI and regular users like hasan only can view and kill itself queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*vH2_7HC3yRS1LVXp0EeGOw.png" /></figure><p>Also hasan user have all types of limitations! this user only have select access to hive catalog, only dw1 schema and on one table “flight”.</p><p>In addition this user have not access to “dest_country_name” in table and also “origin_country_name” will be masked as ‘ — — — ’, also we can do row level filtering for this user with filter option in this file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*Pru85Q27DRcnmzjbVE44ZQ.png" /></figure><p><strong>vim etc/rules.json</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/945d97f350a9f633e27195e769ece00a/href">https://medium.com/media/945d97f350a9f633e27195e769ece00a/href</a></iframe><p>Test with admin user, can select two tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JXbzhzD2RQUSZtANdWLAZQ.png" /></figure><p>Test with hasan user, this user can select only flight table, and only can see two field from this table. this user can not see flight2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZRLfY7Ml4Nvz7RgwlE6sQ.png" /></figure><p>Also “origin_country_name” for this user masked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*YyDrAU2UYni0Kv5LLj4JWA.png" /></figure><p>In Trino UI admin user can see all queries from all users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5bF5HZzCeeNeBI0RqRFjBg.png" /></figure><p>Also hasan user can see only itself queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHNagzHDJXpekk_tuB6X4Q.png" /></figure><p><strong>Conclusion</strong>:</p><p>Trino, by default have not security enabled, for authorization we can use Ranger 2.1 or ACL, for authorization enabling in Trino it’s required to enable SSL and authentication for Trino. Trino built in features covers all types of ACL requirements but best practice is using Ranger and we will cover in another article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ca9c52c78c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Log PrestoSQL/Trino Queries]]></title>
            <link>https://hasanahmadkhani.medium.com/log-prestosql-trino-queries-581ca1336a9f?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/581ca1336a9f</guid>
            <category><![CDATA[presto]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[prestosql]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Sat, 16 Apr 2022 12:59:58 GMT</pubDate>
            <atom:updated>2022-04-25T05:48:46.866Z</atom:updated>
            <content:encoded><![CDATA[<p>PrestoSQL/Trino keeps information about queries for limited time and count and we can view and search on this information with Trino UI.</p><p>We can set parameters to how long and count that is required to Trino keeps queries statistics with below parameters in config.properties file:</p><p>query.min-expire-age=60m<br>query.max-history=50</p><p>But the problem is that if by any reason we restart Trino/PrestoSQL coordinator, we lost the history of this information. for solving this issue we can use a plugin that name is trino-querylog, this plugin as s listener logs all information about queries and we can send this information to storages like Elasticsearch and visualize and search on this data.</p><blockquote>Tools that used in this article :</blockquote><blockquote>IntelliJ IDEA, to build plugin</blockquote><blockquote>Trino 355</blockquote><p>Download release from this path : <a href="https://github.com/hassanahmadkhani/trino-querylog/blob/main/target/trino-querylog-0.4.0-SNAPSHOT-dist.zip">https://github.com/hassanahmadkhani/trino-querylog/blob/main/target/trino-querylog-0.4.0-SNAPSHOT-dist.zip</a></p><p>Or build from code : <a href="https://github.com/hassanahmadkhani/trino-querylog">https://github.com/hassanahmadkhani/trino-querylog</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3GVDVf_QGeiHPqTz9VdSJQ.jpeg" /><figcaption>Build Trino Query Log Plugin</figcaption></figure><blockquote>Steps:</blockquote><ol><li>Create a directory with name trino-querylog in trino_installation_location/plugin</li><li>Extract and put <a href="https://github.com/hassanahmadkhani/trino-querylog/blob/main/target/trino-querylog-0.4.0-SNAPSHOT-dist.zip">trino-querylog-0.4.0-SNAPSHOT-dist.zip</a> content in trino-querylog directory</li><li>create event-listener.properties file in trino_installation_location/etc</li></ol><p>Put below parameters in this configuration file :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fba009a57341617f4b5af42c520412c5/href">https://medium.com/media/fba009a57341617f4b5af42c520412c5/href</a></iframe><p>we only log the query start event, also we can log query end event for duration calculation or something like this. also we can log split details for a query. as you know queries for execution in PrestoSQL/Trino divides into splits.</p><p>4. Create log4j configuration file with name querylog-log4j2.xml in trino_installation_location/etc directory.</p><p>Put below configurations in this file :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ec4830d8bc607c1cfd440999741f9e3/href">https://medium.com/media/9ec4830d8bc607c1cfd440999741f9e3/href</a></iframe><p>5. Restart Trino, before running any query this query will be log in log path in JSON format, below is the sample format of this file :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*OxWxTaJ48PRFPIk_p4KSWA.png" /><figcaption>Sample Query</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cc4768f59f827f37e7df8b85f6d59a1/href">https://medium.com/media/8cc4768f59f827f37e7df8b85f6d59a1/href</a></iframe><p>We can send this logs to Elastic or MongoDB or other storages engines to index and search on history of logs. we can use multiple options for this scenario, for example : Using NiFi/Fluentd/Flume to stream this logs and put in Elastic/MongoDB/Solr/Kafka/… per use case</p><p><strong>Conclusion </strong>:</p><p>With Trino query log we can store Trino queries history for long term and use for analysis, by default after Trino restart we lost this information.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=581ca1336a9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zeppelin to Trino JDBC Connection- Driver Problem]]></title>
            <link>https://hasanahmadkhani.medium.com/zeppelin-to-trino-jdbc-connection-driver-problem-5163a584e7a2?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/5163a584e7a2</guid>
            <category><![CDATA[big-data-and-analytics]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[zeppelin]]></category>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Wed, 06 Apr 2022 05:38:56 GMT</pubDate>
            <atom:updated>2022-04-06T05:40:35.158Z</atom:updated>
            <content:encoded><![CDATA[<p>When we are using Apache Zeppelin as notebook or JDBC client tool for connecting to Trino, we may face some errors like <strong><em>Unrecognized connection property url</em></strong><em> ,…</em></p><p>Based on below image, because Trino deprecated old driver classes from version 351 and we must use new driver class that name is <br><strong>io.trino.jdbc.TrinoDriver </strong>and this driver reject some parameter that zeppelin sent as connection properties</p><p>This article is based on Zeppelin 0.8.1 and Trino 355</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ydz5VjllupehJ8XAaSPy_w.jpeg" /></figure><p>To solve this issue as temp solution till Trino or Zeppelin permanently solve this issue in Zeppelin JDBC interpreter or Trino JDBC driver, we have two solution</p><ol><li>Get Trino JDBC driver code and edit<strong> io.trino.jdbc.TrinoDriverUri</strong> class to handle or skip Unrecognized parameters that zeppelin sent and not in Trino connection properties list and compile code and use this customized version as driver, below images shows the line that must be handle this exception. <a href="https://repo1.maven.org/maven2/io/trino/trino-jdbc/355/trino-jdbc-355-sources.jar">https://repo1.maven.org/maven2/io/trino/trino-jdbc/355/trino-jdbc-355-sources.jar</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sG3JY7V0qJngTEZfUJqZIA.jpeg" /></figure><p>2. Use customized version that I have provided, as temp solution</p><ul><li>download : <a href="https://repo1.maven.org/maven2/io/trino/trino-jdbc/355/trino-jdbc-355.jar">https://repo1.maven.org/maven2/io/trino/trino-jdbc/355/trino-jdbc-355.jar</a></li><li>download : <a href="https://drive.google.com/file/d/1Px8tb8njRTMjeaLFywz5k0xNhlCJh82S/view?usp=sharing">https://drive.google.com/file/d/1Px8tb8njRTMjeaLFywz5k0xNhlCJh82S/view?usp=sharing</a></li><li>open the drive jar file and delete <strong>io.trino.jdbc.TrinoDriverUri </strong>from jar and add customized version</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9yUPb4FlBshWjNkxYR0VA.jpeg" /></figure><p>This scenario solve <strong><em>Unrecognized connection property </em></strong>issue</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5163a584e7a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enable PrestoSQL/Trino Password File Authentication]]></title>
            <link>https://hasanahmadkhani.medium.com/enable-prestosql-trino-password-file-authentication-e70e544c83d9?source=rss-32cdd7f44a08------2</link>
            <guid isPermaLink="false">https://medium.com/p/e70e544c83d9</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Hasan Ahmadkhani]]></dc:creator>
            <pubDate>Mon, 04 Apr 2022 05:39:45 GMT</pubDate>
            <atom:updated>2022-04-25T10:57:12.515Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is dedicated to one of the most fundamental tasks in Trino or PrestoSQL deployment : Enable Authentication and SSL for Trino Coordinator</p><blockquote><em>For this deployment we are going to use two CentOS/Rocky Linux and hostnames are node-master and node1 :</em></blockquote><blockquote>192.168.56.2 node-master node-master.example.com<br>192.168.56.3 node1 node1.example.com</blockquote><p><strong>Software Versions</strong></p><blockquote>Trino 355 [aka PrestoSQL 355] ( <a href="https://repo1.maven.org/maven2/io/trino/trino-server/355/trino-server-355.tar.gz">link</a>)</blockquote><blockquote>Hadoop 3.1.1 (<a href="https://archive.apache.org/dist/hadoop/common/hadoop-3.1.1/hadoop-3.1.1.tar.gz">link</a>)</blockquote><blockquote>MySQL 5.7.28 (<a href="http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.7/mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar">link</a>)</blockquote><blockquote>Hive 3.1.2 (<a href="https://downloads.apache.org/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz">link</a>)</blockquote><blockquote>JDK 11.0.11 (<a href="https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html#license-lightbox">link</a> : jdk-11.0.11_linux-x64_bin.tar.gz) and JDK 8u202 (<a href="http://83.103.170.157/apps/java/jdk_1.8/jdk/jdk-8u202-linux-x64.tar.gz">link</a>)</blockquote><p><strong>Deployment Steps</strong></p><p>Finally, as you know we want to use Trino as SQL on HDFS/Data Lake and we will use Hive Metastore(HMS) as table meta data repository for data lake.</p><ol><li>create two OS user : hdfs and presto</li></ol><p>useradd hdfs<br>passwd hdfs</p><p>useradd presto<br>passwd presto</p><p>2. Install JDK 11.0.11 and JDK 8, Trino 355 works with JDK11 and Hadoop works with JDK 8 : set JAVA_HOME variable in /etc/bashrc to JDK8 installation location and login with presto user and add JAVA_HOME variable to /home/presto/.bashrc file with JDK 11 installation location value</p><p>3. Install Hadoop and start HDFS services : <em>start-dfs.sh</em></p><p>4. Install MySQL in one node, in this scenario in node1 and start service : <em>systemctl start mysqld</em></p><p>5. Install Hive in one node and do all installation steps and run initSchema script to create HMS tables in MySQL and finally start HMS service : <em>hive -service metastore</em></p><p>5. Install Trino in node-master and node1 (brief commands)</p><p>In coordinator(node-master), coordinator is also a worker : node-scheduler.include-coordinator=true</p><p>cd /opt<br>tar trino-server-355.tar.gz<br>mkdir /opt/trino-server-355/etc</p><p>mkdir /opt/trino-server-355/etc/catalog</p><p>vim /opt/trino-server-355/etc/config.properties</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5194d8dfe54f56a2116ba102230b805/href">https://medium.com/media/a5194d8dfe54f56a2116ba102230b805/href</a></iframe><p>vim /opt/trino-server-355/etc/node.properties<br>node.environment=pcluster</p><p>vim /opt/trino-server-355/etc/jvm.config</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a568fb2f25aee9df56b654845aea672e/href">https://medium.com/media/a568fb2f25aee9df56b654845aea672e/href</a></iframe><p>vim /opt/trino-server-355/etc/catalog/hive.properties<br>connector.name=hive-hadoop2<br>hive.metastore.uri=thrift://192.168.56.2:9083</p><p>scp -r /opt/trino-server-355 node1:/opt/</p><p>In worker (node1)</p><blockquote>vim /opt/trino-server-355/etc/config.properties<br>coordinator=false</blockquote><p>Currently we installed Trino without authentication and anyone can connect to Trino coordinator UI and also use CLI to query hive tables : start Trino in all nodes with launcher start command and check coordinator UI <a href="http://node-master:8080/ui/login.html">http://node-master:8080/ui/login.html</a></p><p><strong>CLI :</strong> java -jar presto-cli-328-executable.jar -server <a href="https://node-master.example.com:8443/">http://node-master</a>:8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*T3XYV0Dxbn_2DMaLqA58tg.jpeg" /></figure><p><strong>6. Enable Authentication — Steps</strong></p><blockquote>- Enable SSL/HTTPS for coordinator [mandatory]<br>- Create Password file with httpd-tools<br>- change config.properties<br>- create /opt/trino-server-355/etc/password-authenticator.properties file</blockquote><p><strong>Enable HTTPS</strong></p><p>create truststore and keystore files</p><blockquote>mkdir /opt/security<br>cd /opt/security</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4498f3826d793b655a7ebbd524dcc5f/href">https://medium.com/media/b4498f3826d793b655a7ebbd524dcc5f/href</a></iframe><p><strong>Create Password file with httpd-tools</strong></p><p>yum install httpd-tools</p><blockquote>touch password.db</blockquote><blockquote>create user admin with a password : htpasswd -B -C 10 password.db admin</blockquote><p><strong>Edit config.properties and add</strong></p><p>http-server.authentication.type=PASSWORD<br>http-server.https.enabled=true<br>http-server.https.port=8443<br>http-server.https.keystore.path=/opt/security/keystore.jks<br>http-server.https.keystore.key=password</p><p><strong>Create password-authenticator.properties</strong></p><p>vim /opt/trino-server-355/etc/password-authenticator.properties</p><p>password-authenticator.name=file<br>file.password-file=/opt/security/password.db<br>file.refresh-period=1m<br>file.auth-token-cache.max-size=1000</p><p><strong>Restart Coordinator</strong></p><p>HTTP UI disabled : <a href="http://node-master:8080/">http://node-master:8080/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*MOBSJdFQdpnqmxdqf7uAcA.jpeg" /></figure><p>HTTPS UI is available and you can login with username and password that you have: <a href="https://node-master.example.com:8443/ui/login.html">https://node-master.example.com:8443/ui/login.html</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*SIw-7Q3p1uUrjak-Q8wyFg.jpeg" /></figure><p><strong>Use CLI to connect :</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11d091a4a2a485472c236c91eaa5c4b0/href">https://medium.com/media/11d091a4a2a485472c236c91eaa5c4b0/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*HlBnAmwHLDLb4nYdLccIwg.jpeg" /><figcaption>select result after authentication</figcaption></figure><p><strong>Use JDBC client tools to connect, for example intelliJ IDEA data source plugin</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*U5wmswfN78m5ukd0b-fOaw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*64Ybqw0hmdal7R2Yd4Ndlg.jpeg" /><figcaption>SSL Parameters</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P8Nq4R0fMIV_Orgr9Uwg1Q.jpeg" /></figure><p>In this step you maybe face error if you want to connect from zeppelin JDBC interpreter, it’s related to Trino JDBC and parameters that zeppelin sent to driver, you can find solution in this article: <a href="https://medium.com/@hasanahmadkhani/zeppelin-to-trino-jdbc-connection-driver-problem-5163a584e7a2">Zeppelin to Trino JDBC Connection - Driver Problem</a></p><p>Also I will describe how to integrate Trino with LDAP and how to handle user impersonation from Zeppelin to Trino in another article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e70e544c83d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>