-storesimply needs to be set to
postgres(the two drivers supported at the moment). The parameter
-sql_sourceis driver specific, but generally contains the information required to connect to a specific database on the given SQL database server. You can find the connect options in the respective driver repositories: MySQL and Postgres.
scripts/postgres.db.sql) that can be used to create the tables and indexes to the database of your choice. However, administrators are free to configure and optimize the database as long as the name of tables and columns are preserved, since the NATS Streaming Server is going to issue SQL statements based on those.
passwordfor the MySQL database:
nss. Once this user is created, we can then create the tables using this user and selecting the
nss_dbdatabase. We then execute all the SQL statements creating the tables from the sql file that is provided in this repo:
-SDVoption to the command line. You may not want to leave this setting on in production because it can be too verbose and affect performance.
writeTimeoutoptions to the
sql_sourcewhen starting the server. The MySQL driver had always had those options, but we have extended the Postgres driver that we use to provide those options in NATS Streaming
v0.16.0. You pass the values as a duration, for instance
5sfor 5 seconds.
sql_sourcewould look like for
max_open_conns) that you may need to set to avoid errors due to
too many opened files.
no_cachingwhich is a boolean that enables/disables caching. By default caching is enabled. It means that some operations are buffered in memory before being sent to the database. For storing messages, this still offers the guarantee that if a producer gets an OK ack back, the message will be successfully persisted in the database.