# Setting rocksdb parameters in cnf file when compiling MyRocks from source

**URL:** <https://forums.percona.com/t/setting-rocksdb-parameters-in-cnf-file-when-compiling-myrocks-from-source/20955>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [March 26, 2023, 8:52am UTC](https://forums.percona.com/t/setting-rocksdb-parameters-in-cnf-file-when-compiling-myrocks-from-source/20955 "2023-03-26T08:52:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShmuelDashevsky](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@ShmuelDashevsky](https://forums.percona.com/u/ShmuelDashevsky)\
**Post date:** [March 26, 2023, 8:52am UTC](https://forums.percona.com/t/setting-rocksdb-parameters-in-cnf-file-when-compiling-myrocks-from-source/20955/1 "2023-03-26T08:52:10Z")

</div>

Hi,  
I’m compiling percona-server from source, as in the installation guide.

Then run mysql using cnf file from here - [blog\_data/mysqld.cnf at master · y-trudeau/blog\_data · GitHub](https://github.com/y-trudeau/blog_data/blob/master/InnoDBVsMyRocks/sysbench-tpcc/mysqld.cnf)  
This is the configuration used in the post - [https://www.percona.com/blog/myrocks-use-case/](https://www.percona.com/blog/myrocks-use-case/)

to run mysql I use the following commands -  
mysqld --defaults-file=/etc/my.cnf --initialize-insecure  
mysqld --defaults-file=/etc/my.cnf &

mysql fails with the following error:  
[ERROR] [MY-000067] [Server] unknown variable ‘rocksdb\_default\_cf\_options=write\_buffer\_size=64m;target\_file\_size\_base=32m;max\_bytes\_for\_level\_base=512m;level0\_file\_num\_compaction\_trigger=4;level0\_slowdown\_writes\_trigger=10;level0\_stop\_writes\_trigger=15;max\_write\_buffer\_number=4;compression\_per\_level=kLZ4Compression;bottommost\_compression=kZSTD;compression\_opts=-14:1:0;block\_based\_table\_factory={cache\_index\_and\_filter\_blocks=1;filter\_policy=bloomfilter:10:false;whole\_key\_filtering=1};level\_compaction\_dynamic\_level\_bytes=true;optimize\_filters\_for\_hits=true;compaction\_pri=kMinOverlappingRatio’.

It seems that mysql has not rocksDB enabled yet.  
The only way I see to enable rocksDB is to run in mySQL the set of INSTALL PLUGIN ROCKSDB commands  
This can be done after mysql is already running, but I can’t bring up mysql with rocksdb parameters in the cnf file.

What are the correct steps to bring up MyRocks from source with specific rocksdb parameters?

Thanks,  
Shmuel

---

<div class="post-metadata">

**Author:** ![ShmuelDashevsky](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@ShmuelDashevsky](https://forums.percona.com/u/ShmuelDashevsky)\
**Post date:** [March 26, 2023, 8:53am UTC](https://forums.percona.com/t/setting-rocksdb-parameters-in-cnf-file-when-compiling-myrocks-from-source/20955/2 "2023-03-26T08:53:43Z")

</div>

The exact cnf file I used is:

[mysqld]

datadir=/media/myrocks\_data  
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log.SW  
pid-file=/var/run/mysqld/mysqld.pid  
port=3337  
user=root

rocksdb\_default\_cf\_options=write\_buffer\_size=64m;target\_file\_size\_base=32m;max\_bytes\_for\_level\_base=512m;level0\_file\_num\_compaction\_trigger=4;level0\_slowdown\_writes\_trigger=10;level0\_stop\_writes\_trigger=15;max\_write\_buffer\_number=4;compression\_per\_level=kLZ4Compression;bottommost\_compression=kZSTD;compression\_opts=-14:1:0;block\_based\_table\_factory={cache\_index\_and\_filter\_blocks=1;filter\_policy=bloomfilter:10:false;whole\_key\_filtering=1};level\_compaction\_dynamic\_level\_bytes=true;optimize\_filters\_for\_hits=true;compaction\_pri=kMinOverlappingRatio  
rocksdb\_block\_size=16384  
rocksdb\_bytes\_per\_sync=4194304  
rocksdb\_compaction\_sequential\_deletes=199999  
rocksdb\_compaction\_sequential\_deletes\_count\_sd=1  
rocksdb\_compaction\_sequential\_deletes\_window=200000  
rocksdb\_max\_background\_jobs=8  
rocksdb\_max\_open\_files=-1  
rocksdb\_table\_cache\_numshardbits=6  
transaction\_isolation=READ-COMMITTED  
rocksdb\_block\_cache\_size=32G  
rocksdb\_max\_total\_wal\_size=4G  
rocksdb\_rate\_limiter\_bytes\_per\_sec=104857600  
rocksdb\_wal\_recovery\_mode=2  
performance\_schema=off  
rocksdb\_large\_prefix=1  
rocksdb\_use\_direct\_io\_for\_flush\_and\_compaction=1  
sql\_mode=NO\_ENGINE\_SUBSTITUTION,STRICT\_ALL\_TABLES  
symbolic-links=0  
skip-log-bin  
skip-name-resolve

datadir=/media/myrocks\_data  
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log.SW  
pid-file=/var/run/mysqld/mysqld.pid  
port=3337  
user=root

rocksdb\_default\_cf\_options=write\_buffer\_size=64m;target\_file\_size\_base=32m;max\_bytes\_for\_level\_base=512m;level0\_file\_num\_compaction\_trigger=4;level0\_slowdown\_writes\_trigger=10;level0\_stop\_writes\_trigger=15;max\_write\_buffer\_number=4;compression\_per\_level=kLZ4Compression;bottommost\_compression=kZSTD;compression\_opts=-14:1:0;block\_based\_table\_factory={cache\_index\_and\_filter\_blocks=1;filter\_policy=bloomfilter:10:false;whole\_key\_filtering=1};level\_compaction\_dynamic\_level\_bytes=true;optimize\_filters\_for\_hits=true;compaction\_pri=kMinOverlappingRatio  
rocksdb\_block\_size=16384  
rocksdb\_bytes\_per\_sync=4194304  
rocksdb\_compaction\_sequential\_deletes=199999  
rocksdb\_compaction\_sequential\_deletes\_count\_sd=1  
rocksdb\_compaction\_sequential\_deletes\_window=200000  
rocksdb\_max\_background\_jobs=8  
rocksdb\_max\_open\_files=-1  
rocksdb\_table\_cache\_numshardbits=6  
transaction\_isolation=READ-COMMITTED  
rocksdb\_block\_cache\_size=32G  
rocksdb\_max\_total\_wal\_size=4G  
rocksdb\_rate\_limiter\_bytes\_per\_sec=104857600  
rocksdb\_wal\_recovery\_mode=2  
performance\_schema=off  
rocksdb\_large\_prefix=1  
rocksdb\_use\_direct\_io\_for\_flush\_and\_compaction=1  
sql\_mode=NO\_ENGINE\_SUBSTITUTION,STRICT\_ALL\_TABLES  
symbolic-links=0  
skip-log-bin  
skip-name-resolve

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [March 27, 2023, 4:43pm UTC](https://forums.percona.com/t/setting-rocksdb-parameters-in-cnf-file-when-compiling-myrocks-from-source/20955/3 "2023-03-27T16:43:02Z")

</div>

> [@ShmuelDashevsky](#):
>
> This can be done after mysql is already running, but I can’t bring up mysql with rocksdb parameters in the cnf file.
> 
> What are the correct steps to bring up MyRocks from source with specific rocksdb parameters?

Yes, correct. MySQL will not recognize variables for plugins until after the plugin is loaded. You can use the following in your my.cnf `plugin-load-add=ha_rocksdb.so` before the rocksdb\_\* variables. You can also prefix all rocksdb variables with `loose_` if you want to INSTALL PLUGIN after starting MySQL.
