2017-04-26 16:07:48 +00:00
Getting started
2017-06-13 04:15:47 +00:00
===============
2017-07-04 12:53:50 +00:00
2017-04-26 16:07:48 +00:00
System requirements
2017-06-13 04:15:47 +00:00
-------------------
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
This is not a cross-platform system. It requires Linux Ubuntu Precise (12.04) or newer, x86_64 architecture with SSE 4.2 instruction set.
To test for SSE 4.2 support, do:
2017-06-13 04:15:47 +00:00
.. code-block :: text
2017-04-03 19:49:50 +00:00
grep -q sse4_2 /proc/cpuinfo && echo "SSE 4.2 supported" || echo "SSE 4.2 not supported"
2017-04-26 16:07:48 +00:00
We recommend using Ubuntu Trusty or Ubuntu Xenial or Ubuntu Precise.
The terminal must use UTF-8 encoding (the default in Ubuntu).
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Installation
2017-06-13 04:15:47 +00:00
------------
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
For testing and development, the system can be installed on a single server or on a desktop computer.
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Installing from packages
2017-06-13 04:15:47 +00:00
~~~~~~~~~~~~~~~~~~~~~~~~
2017-04-03 19:49:50 +00:00
2017-07-04 12:53:50 +00:00
In `/etc/apt/sources.list` (or in a separate `/etc/apt/sources.list.d/clickhouse.list` file), add the repository:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: text
2017-04-03 19:49:50 +00:00
deb http://repo.yandex.ru/clickhouse/trusty stable main
2017-04-26 16:07:48 +00:00
For other Ubuntu versions, replace `trusty` to `xenial` or `precise` .
2017-07-04 12:53:50 +00:00
If you want to use the most fresh testing version of ClickHouse, replace `stable` to `testing` .
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Then run:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
2017-04-03 19:49:50 +00:00
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4 # optional
sudo apt-get update
sudo apt-get install clickhouse-client clickhouse-server-common
2017-07-04 12:53:50 +00:00
2017-04-26 16:07:48 +00:00
You can also download and install packages manually from here:
2017-04-03 19:49:50 +00:00
http://repo.yandex.ru/clickhouse/trusty/pool/main/c/clickhouse/,
http://repo.yandex.ru/clickhouse/xenial/pool/main/c/clickhouse/,
http://repo.yandex.ru/clickhouse/precise/pool/main/c/clickhouse/.
2017-04-26 16:07:48 +00:00
ClickHouse contains access restriction settings. They are located in the 'users.xml' file (next to 'config.xml').
By default, access is allowed from everywhere for the default user without a password. See 'user/default/networks'. For more information, see the section "Configuration files".
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Installing from source
2017-06-13 04:15:47 +00:00
~~~~~~~~~~~~~~~~~~~~~~
2017-04-26 16:07:48 +00:00
To build, follow the instructions in build.md (for Linux) or in build_osx.md (for Mac OS X).
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
You can compile packages and install them. You can also use programs without installing packages.
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: text
2017-04-26 16:07:48 +00:00
Client: dbms/src/Client/
Server: dbms/src/Server/
2017-04-03 19:49:50 +00:00
2017-09-12 19:47:39 +00:00
For the server, create a directory with data, such as:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: text
2017-04-03 19:49:50 +00:00
/opt/clickhouse/data/default/
/opt/clickhouse/metadata/default/
2017-07-04 12:53:50 +00:00
2017-04-26 16:07:48 +00:00
(Configured in the server config.)
Run 'chown' for the desired user.
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Note the path to logs in the server config (src/dbms/src/Server/config.xml).
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Other methods of installation
2017-06-13 04:15:47 +00:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-04-26 16:07:48 +00:00
The Docker image is located here: https://hub.docker.com/r/yandex/clickhouse-server/
2017-04-03 19:49:50 +00:00
2017-09-12 19:43:30 +00:00
There are RPM packages for CentOS, RHEL: https://github.com/Altinity/clickhouse-rpm-install
2017-04-26 16:07:48 +00:00
There is Gentoo overlay located here: https://github.com/kmeaw/clickhouse-overlay
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Launch
2017-06-13 04:15:47 +00:00
------
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
To start the server (as a daemon), run:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
2017-04-03 19:49:50 +00:00
sudo service clickhouse-server start
2017-07-04 12:53:50 +00:00
2017-09-12 19:47:39 +00:00
View the logs in the directory `/var/log/clickhouse-server/`
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
If the server doesn't start, check the configurations in the file `/etc/clickhouse-server/config.xml`
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
You can also launch the server from the console:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
2017-04-03 19:49:50 +00:00
clickhouse-server --config-file=/etc/clickhouse-server/config.xml
2017-07-04 12:53:50 +00:00
2017-04-26 16:07:48 +00:00
In this case, the log will be printed to the console, which is convenient during development. If the configuration file is in the current directory, you don't need to specify the '--config-file' parameter. By default, it uses './config.xml'.
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
You can use the command-line client to connect to the server:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
2017-04-03 19:49:50 +00:00
clickhouse-client
2017-04-26 16:07:48 +00:00
The default parameters indicate connecting with localhost:9000 on behalf of the user 'default' without a password.
The client can be used for connecting to a remote server. For example:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
2017-04-03 19:49:50 +00:00
clickhouse-client --host=example.com
2017-07-04 12:53:50 +00:00
2017-04-26 16:07:48 +00:00
For more information, see the section "Command-line client".
2017-04-03 19:49:50 +00:00
2017-04-26 16:07:48 +00:00
Checking the system:
2017-06-13 20:35:07 +00:00
2017-06-13 04:15:47 +00:00
.. code-block :: bash
milovidov@hostname:~/work/metrica/src/dbms/src/Client$ ./clickhouse-client
2017-04-03 19:49:50 +00:00
ClickHouse client version 0.0.18749.
Connecting to localhost:9000.
Connected to ClickHouse server version 0.0.18749.
2017-07-04 12:53:50 +00:00
2017-04-03 19:49:50 +00:00
:) SELECT 1
2017-07-04 12:53:50 +00:00
2017-04-03 19:49:50 +00:00
SELECT 1
2017-07-04 12:53:50 +00:00
2017-04-03 19:49:50 +00:00
┌─1─┐
│ 1 │
└───┘
2017-07-04 12:53:50 +00:00
2017-04-03 19:49:50 +00:00
1 rows in set. Elapsed: 0.003 sec.
2017-07-04 12:53:50 +00:00
2017-04-03 19:49:50 +00:00
:)
2017-06-20 14:19:03 +00:00
**Congratulations, it works!**
For further experiments you can try playing with one of the following example datasets:
.. toctree ::
:glob:
example_datasets/*