Build-Depends: debhelper (>= 9),
cmake3 | cmake,
- ninja-build,
+ ninja-build [amd64 i386],
gcc-7, g++-7,
libc6-dev,
libmariadbclient-dev | default-libmysqlclient-dev | libmysqlclient-dev,
@@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 9),
Standards-Version: 3.9.8
Package: clickhouse-client
-Architecture: any
+Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, clickhouse-common-static (= ${binary:Version}) | clickhouse-server-base (= ${binary:Version})
Replaces: clickhouse-compressor
Conflicts: clickhouse-compressor
@@ -38,7 +38,7 @@ Description: Common files for clickhouse
This package provides common files for both clickhouse server and client
Package: clickhouse-server
-Architecture: any
+Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, clickhouse-common-static (= ${binary:Version}), adduser
Replaces: clickhouse-server-common, clickhouse-server-base
Provides: clickhouse-server-common
@@ -60,7 +60,7 @@ Description: debugging symbols for clickhouse-common-static
Package: clickhouse-test
Priority: optional
-Architecture: any
+Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, clickhouse-client, bash, expect, python, python-lxml, python-termcolor, python-requests, curl, perl, sudo, openssl
Description: Clickhouse tests
@@ -72,10 +72,10 @@ Package: clickhouse-server-base
Architecture: any
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, tzdata
-Description: DEPRECATED PACKAGE: Server binary for clickhouse
+Description: DEPRECATED PACKAGE (use clickhouse-common-static): Server binary for clickhouse
Package: clickhouse-server-common
-Architecture: any
+Architecture: all
Priority: optional
Depends: ${shlibs:Depends}, ${misc:Depends}, clickhouse-server-base (= ${binary:Version})
-Description: DEPRECATED PACKAGE: Common configuration files for clickhouse-server-base package
+Description: DEPRECATED PACKAGE (use clickhouse-server): Common configuration files for clickhouse-server-base package
diff --git a/debian/rules b/debian/rules
index 245a148ff89..f51b55f3746 100755
--- a/debian/rules
+++ b/debian/rules
@@ -53,8 +53,13 @@ ifndef DH_VERBOSE
CMAKE_FLAGS += -DCMAKE_VERBOSE_MAKEFILE=0
endif
+# Useful for bulding on low memory systems
+ifndef DISABLE_PARALLEL
+ DH_FLAGS += --parallel
+endif
+
%:
- dh $@ --parallel --buildsystem=cmake --builddirectory=$(BUILDDIR)
+ dh $@ $(DH_FLAGS) --buildsystem=cmake --builddirectory=$(BUILDDIR)
override_dh_auto_configure:
dh_auto_configure -- $(CMAKE_FLAGS)
diff --git a/docker/server/Dockerfile b/docker/server/Dockerfile
index 1ee459693c0..78d7c7b2115 100644
--- a/docker/server/Dockerfile
+++ b/docker/server/Dockerfile
@@ -9,7 +9,7 @@ RUN apt-get update && \
apt-key adv --keyserver keyserver.ubuntu.com --recv E0C56BD4 && \
echo $repository | tee /etc/apt/sources.list.d/clickhouse.list && \
apt-get update && \
- apt-get install --allow-unauthenticated -y "clickhouse-server|clickhouse-server-common=$version" libgcc-7-dev && \
+ apt-get install --allow-unauthenticated -y "clickhouse-server=$version" libgcc-7-dev && \
rm -rf /var/lib/apt/lists/* /var/cache/debconf && \
apt-get clean
diff --git a/docs/en/operations/access_rights.md b/docs/en/operations/access_rights.md
index 1c72bf13b3e..0342288d8d4 100755
--- a/docs/en/operations/access_rights.md
+++ b/docs/en/operations/access_rights.md
@@ -2,14 +2,14 @@
Users and access rights are set up in the user config. This is usually `users.xml`.
-Users are recorded in the 'users' section. Here is a fragment of the `users.xml` file:
+Users are recorded in the `users` section. Here is a fragment of the `users.xml` file:
```xml
-
default
-
+
-
-
-
-
- web
- default
-
- test
+
+
+
+
+ web
+ default
+
+ test
+
```
-You can see a declaration from two users: `default`and`web`. We added the `web` user separately.
+You can see a declaration from two users: `default` and `web`. We added the `web` user separately.
The `default` user is chosen in cases when the username is not passed. The `default` user is also used for distributed query processing, if the configuration of the server or cluster doesn't specify the `user` and `password` (see the section on the [Distributed](../table_engines/distributed.md#table_engines-distributed) engine).
diff --git a/docs/mkdocs-material-theme/partials/nav.html b/docs/mkdocs-material-theme/partials/nav.html
index 2d65e408fda..9a5c4b3da09 100644
--- a/docs/mkdocs-material-theme/partials/nav.html
+++ b/docs/mkdocs-material-theme/partials/nav.html
@@ -25,9 +25,9 @@
diff --git a/docs/ru/query_language/queries.md b/docs/ru/query_language/queries.md
index 61957616f2c..5e37137d4a0 100644
--- a/docs/ru/query_language/queries.md
+++ b/docs/ru/query_language/queries.md
@@ -1,3 +1,5 @@
+
+
# Запросы
## CREATE DATABASE
diff --git a/docs/ru/utils/clickhouse-local.md b/docs/ru/utils/clickhouse-local.md
index 0cee8e4ee3c..64aec03ab76 100644
--- a/docs/ru/utils/clickhouse-local.md
+++ b/docs/ru/utils/clickhouse-local.md
@@ -1,5 +1,70 @@
-#clickhouse-local
+# clickhouse-local
-Программа `clickhouse-local` позволяет выполнять быструю обработку локальных файлов, хранящих таблицы, не прибегая к развертыванию и настройке сервера ClickHouse.
+Принимает на вход данные, которые можно представить в табличном виде и выполняет над ними операции, заданные на [языке запросов](../query_language/queries.md#queries) ClickHouse.
+
+`clickhouse-local` использует движок сервера ClickHouse, т.е. поддерживает все форматы данных и движки таблиц, с которыми работает ClickHouse, при этом для выполнения операций не требуется запущенный сервер.
+
+`clickhouse-local` при настройке по умолчанию не имеет доступа к данным, которыми управляет сервер ClickHouse, установленный на этом же хосте, однако можно подключить конфигурацию сервера с помощью ключа `--config-file`.
+
+
+Мы не рекомендуем подключать серверную конфигурацию к `clickhouse-local`, поскольку данные можно легко повредить неосторожными действиями.
+
+
+
+## Вызов программы
+
+Основной формат вызова:
+
+``` bash
+clickhouse-local --structure "table_structure" --input-format "format_of_incoming_data" -q "query"
+```
+
+Ключи команды:
+
+- `-S`, `--structure` — структура таблицы, в которую будут помещены входящие данные.
+- `-if`, `--input-format` — формат входящих данных. По умолчанию — `TSV`.
+- `-f`, `--file` — путь к файлу с данными. По умолчанию — `stdin`.
+- `-q` `--query` — запросы на выполнение. Разделитель запросов — `;`.
+- `-N`, `--table` — имя таблицы, в которую будут помещены входящие данные. По умолчанию - `table`.
+- `-of`, `--format`, `--output-format` — формат выходных данных. По умолчанию — `TSV`.
+- `--stacktrace` — вывод отладочной информации при исключениях.
+- `--verbose` — подробный вывод при выполнении запроса.
+- `-s` — отключает вывод системных логов в `stderr`.
+- `--config-file` — путь к файлу конфигурации. По умолчанию `clickhouse-local` запускается с пустой конфигурацией. Конфигурационный файл имеет тот же формат, что и для сервера ClickHouse и в нём можно использовать все конфигурационные параметры сервера. Обычно подключение конфигурации не требуется, если требуется установить отдельный параметр, то это можно сделать ключом с именем параметра.
+- `--help` — вывод справочной информации о `clickhouse-local`.
+
+
+## Примеры вызова
+
+``` bash
+echo -e "1,2\n3,4" | clickhouse-local -S "a Int64, b Int64" -if "CSV" -q "SELECT * FROM table"
+Read 2 rows, 32.00 B in 0.000 sec., 5182 rows/sec., 80.97 KiB/sec.
+1 2
+3 4
+```
+
+Вызов выше эквивалентен следующему:
+
+``` bash
+$ echo -e "1,2\n3,4" | clickhouse-local -q "CREATE TABLE table (a Int64, b Int64) ENGINE = File(CSV, stdin); SELECT a, b FROM table; DROP TABLE table"
+Read 2 rows, 32.00 B in 0.000 sec., 4987 rows/sec., 77.93 KiB/sec.
+1 2
+3 4
+```
+
+А теперь давайте выведем на экран объем оперативной памяти, занимаемой пользователями (Unix):
+
+``` bash
+$ ps aux | tail -n +2 | awk '{ printf("%s\t%s\n", $1, $4) }' | clickhouse-local -S "user String, mem Float64" -q "SELECT user, round(sum(mem), 2) as memTotal FROM table GROUP BY user ORDER BY memTotal DESC FORMAT Pretty"
+Read 186 rows, 4.15 KiB in 0.035 sec., 5302 rows/sec., 118.34 KiB/sec.
+┏━━━━━━━━━━┳━━━━━━━━━━┓
+┃ user ┃ memTotal ┃
+┡━━━━━━━━━━╇━━━━━━━━━━┩
+│ bayonet │ 113.5 │
+├──────────┼──────────┤
+│ root │ 8.8 │
+├──────────┼──────────┤
+...
+```
diff --git a/libs/libdaemon/src/BaseDaemon.cpp b/libs/libdaemon/src/BaseDaemon.cpp
index e262b2df17c..ff1fbabceb1 100644
--- a/libs/libdaemon/src/BaseDaemon.cpp
+++ b/libs/libdaemon/src/BaseDaemon.cpp
@@ -706,17 +706,18 @@ void BaseDaemon::buildLoggers(Poco::Util::AbstractConfiguration & config)
Poco::AutoPtr split = new SplitterChannel;
auto log_level = config.getString("logger.level", "trace");
- if (config.hasProperty("logger.log"))
+ const auto log_path = config.getString("logger.log", "");
+ if (!log_path.empty())
{
- createDirectory(config.getString("logger.log"));
- std::cerr << "Logging " << log_level << " to " << config.getString("logger.log") << std::endl;
+ createDirectory(log_path);
+ std::cerr << "Logging " << log_level << " to " << log_path << std::endl;
// Set up two channel chains.
Poco::AutoPtr pf = new OwnPatternFormatter(this);
pf->setProperty("times", "local");
Poco::AutoPtr log = new FormattingChannel(pf);
log_file = new FileChannel;
- log_file->setProperty(Poco::FileChannel::PROP_PATH, Poco::Path(config.getString("logger.log")).absolute().toString());
+ log_file->setProperty(Poco::FileChannel::PROP_PATH, Poco::Path(log_path).absolute().toString());
log_file->setProperty(Poco::FileChannel::PROP_ROTATION, config.getRawString("logger.size", "100M"));
log_file->setProperty(Poco::FileChannel::PROP_ARCHIVE, "number");
log_file->setProperty(Poco::FileChannel::PROP_COMPRESS, config.getRawString("logger.compress", "true"));
@@ -728,17 +729,18 @@ void BaseDaemon::buildLoggers(Poco::Util::AbstractConfiguration & config)
log_file->open();
}
- if (config.hasProperty("logger.errorlog"))
+ const auto errorlog_path = config.getString("logger.errorlog", "");
+ if (!errorlog_path.empty())
{
- createDirectory(config.getString("logger.errorlog"));
- std::cerr << "Logging errors to " << config.getString("logger.errorlog") << std::endl;
+ createDirectory(errorlog_path);
+ std::cerr << "Logging errors to " << errorlog_path << std::endl;
Poco::AutoPtr level = new Poco::LevelFilterChannel;
level->setLevel(Message::PRIO_NOTICE);
Poco::AutoPtr pf = new OwnPatternFormatter(this);
pf->setProperty("times", "local");
Poco::AutoPtr errorlog = new FormattingChannel(pf);
error_log_file = new FileChannel;
- error_log_file->setProperty(Poco::FileChannel::PROP_PATH, Poco::Path(config.getString("logger.errorlog")).absolute().toString());
+ error_log_file->setProperty(Poco::FileChannel::PROP_PATH, Poco::Path(errorlog_path).absolute().toString());
error_log_file->setProperty(Poco::FileChannel::PROP_ROTATION, config.getRawString("logger.size", "100M"));
error_log_file->setProperty(Poco::FileChannel::PROP_ARCHIVE, "number");
error_log_file->setProperty(Poco::FileChannel::PROP_COMPRESS, config.getRawString("logger.compress", "true"));
@@ -965,9 +967,9 @@ void BaseDaemon::initialize(Application & self)
}
/// Change path for logging.
- if (config().hasProperty("logger.log"))
+ if (!log_path.empty())
{
- std::string path = createDirectory(config().getString("logger.log"));
+ std::string path = createDirectory(log_path);
if (is_daemon
&& chdir(path.c_str()) != 0)
throw Poco::Exception("Cannot change directory to " + path);