Settings. Initial
File Descriptors.
By default Clickhouse service set high ulimit
sudo systemctl show clickhouse-server.service |grep NOFILEAs you can see

It can be increased by service edit if it is less than 100000
Then pass
And check
Max Memory Usage
By default there is no need to setup max_server_memory_usage. It is calculated as 90% of total memory. Giving 10% for system needs.
But if you have less than 40GB of RAM it is good thing to give system fixed 4GB of RAM.
Create settings file and restart service.
And pass RAM-4GB (in my case it is 32GB RAM on server)
Restart service
And check setting in ch client
Shared Memory.
Check if kernel has big kernel.shmmax. It is in bytes and must be greater than 1GB.

You can change it with
Than add
Than apply
Limit Disk Space.
You should limit disk space used if disk is used by another processes too.
For that we should create disk policy.
Create additional config
Add this content
Restart service and check disks in CH
Now CH now about disks

Create Policy
Paste policy for single disk
Clickhouse will not migrate dbs\tables to another disk! You should create new tables with new settings or manually copy and modify existent (not in this manual) tables.
Insert data in new table
Check parts location
New table is on another disk

Logging Setup
Create logging config and dir
Paste the following content
Misc.
Create other settings.
Put this in
Additional Users.
By default there is superuser default. But. You can create roles and new users. The old way is to do it with users.d/file method. This files are constantly monitored by clickhouse and applied. You can do the same by SQL commands inside clickhouse client. But files have priority.
Create file
Generate password
You will get random password and its hash

And pass this content and use hash to hide password in config.
Now create profiles and quota files
Content
Quotas file
Content
Performance Tests.
Let's run some benchmarks on clickhouse.
This first test is for default ch binaries on empty machine without ch installed.
Download test and clickhouse binary with a script. Set the db downloaded size from 255 sets to 50
The output should be like this. If no, check paths.

Now we will modify test to use installed and tuned ch (therefore you should install it now and use tweaks above).
Comment this sections in hardware.sh and change paths to use service and not local binary.
Paths with sed
And run again
Compare with new results
Last updated
Was this helpful?