How to connect to external clickhouse dictionary mysql?

Added in file /etc/clickhouse-server/config.xml
<dictionaries_config>/etc/clickhouse-server/mysql-dictionary.xml</dictionaries_config>
 <dictionaries_lazy_load>false</dictionaries_lazy_load>


Created a file with the settings dictionary etc/clickhouse-server/mysql-dictionary.xml
<dictionary>
 <name>mysql_user_actions</name> 
<source>
<mysql>
<port>3306</port>
<user>admin</user>
<password>passwd</password>
<replica>
<host>localhost></host>
<priority>1</priority>
</replica>
<db>log</db>
<table>user_action</table>
<where></where>
<invalidate_query>SQL_QUERY</invalidate_query>
</mysql>
</source>
<layout>
 <flat />
</layout>
<structure>
<id>
<name>id</name>
</id>
<attribute>
<name>action_name</name>
<type>string</type>
<null_value>Unknown</null_value>
</attribute>
</structure>
the <lifetime>846500</lifetime>
</dictionary>


When you try to use a dictionary in the query an exception is thrown:
:) select datetime, session_id, dictGetString('mysql_user_actions', 'action_name', action_id) as action from user_action group by datetime, session_id, action;

SELECT 
 datetime 
 session_id, 
 dictGetString('mysql_user_actions', 'action_name', action_id) AS action
FROM user_action 
GROUP BY 
 datetime 
 session_id, 
action

Exception Received from server (version 18.12.17):
Code: 36. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: No such external dictionary: mysql_user_actions


I understand that he's looking for a dictionary on port 9000. I.e. my config is not correct. I took the example config from the official documentation.
In the server logs there is a GTA V on garage door by connecting to this Glossary as I understand it.
2018.10.11 10:10:16.266257 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'name', expected 'dictionary'
2018.10.11 10:10:16.266305 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'source', expected 'dictionary'
2018.10.11 10:10:16.266323 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'layout', expected 'dictionary'
2018.10.11 10:10:16.266340 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: in file unknown node: 'structure', expected 'dictionary'
2018.10.11 10:10:16.266357 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'lifetime', expected 'dictionary'
2018.10.11 10:20:16.340788 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'source', expected 'dictionary'
2018.10.11 10:20:16.340831 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'layout', expected 'dictionary'
2018.10.11 10:20:16.340849 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: in file unknown node: 'structure', expected 'dictionary'
2018.10.11 10:20:16.340866 [ 31 ] <Warning> ExternalDictionaries: /etc/clickhouse-server/mysql-dictionary.xml: unknown node in file: 'lifetime', expected 'dictionary'

How to make friends clickhouse and mysql?
March 12th 20 at 08:12
1 answer
March 12th 20 at 08:14
Solution
It was necessary to wrap everything in a block
<yandex>...</yandex>

Find more questions by tags ClickHouseMySQL