yum install -y unixODBC.x86_64
yum install -y postgresql-odbc.x86_64
vim /etc/odbc.ini
1[pg] 2Description = Test to pg 3Driver = PostgreSQL #与/etc/odbcinst.ini 中一致 4Database = postgres 5Servername = 192.168.9.139 6UserName = admin 7Password = admin 8Port = 5432 9ReadOnly = 0
vim /etc/clickhouse-server/test_dictionary.xml
1<dictionaries> 2 <dictionary> 3 <name>test</name> 4 <source> 5 <odbc> 6 <connection_string>DSN=pg;UID=;PWD=;HOST=;PORT=5432;DATABASE=</connection_string> 7 <table>product</table> 8 </odbc> 9 </source> 10 <lifetime> 11 <min>300</min> 12 <max>360</max> 13 </lifetime> 14 <layout> 15 <hashed/> 16 </layout> 17 <structure> 18 <id> 19 <name>id</name> 20 </id> 21 <attribute> 22 <name>del_flag</name> 23 <type>UInt64</type> 24 <null_value>0</null_value> 25 </attribute> 26 </structure> 27 </dictionary> 28</dictionaries>