Database Reset

Prev Next

By default the database is not reset where data is constantly added to the tables. In many cases resetting the data base to clear out all data can be helpful.

To reset follow these steps

Step 1) Change directory

Change to the following directory inside the LXC container

cd /root/market2json/

Example output

root@fmadio100v2-228U-market2json:~# cd /root/market2json/
root@fmadio100v2-228U-market2json:~/market2json#

Step 2) Run reset script

Run the reset script as follows

 ./market2json-reset.lua

Example output

root@fmadio100v2-228U-market2json:~/market2json# ./market2json-reset.lua                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     07:26:28 [16/9542]
cp /root/market2json/fmadio-market2json-*.service /etc/systemd/system
mkdir /opt/fmadio/app/market2json -p
cp /root/market2json/market2json.lua /opt/fmadio/app/market2json
Sleep...0
Sleep...1
Sleep...2
Sleep...3
Sleep...4
Sleep...5
deleteing table market2json_gap_event
clickhouse-client --password fmad-secret --query "DROP TABLE fmadio.market2json_gap_event"
deleteing table market2json_gap_event_1sec
clickhouse-client --password fmad-secret --query "DROP TABLE fmadio.market2json_gap_event_1sec"
.
.
.
rm /etc/rsyslog.d/*
cp /root/market2json/rsyslog-clickhouse-market2json.conf /etc/rsyslog.d/
chmod 777 /mnt/log/
systemctl restart rsyslog
Done.
root@fmadio100v2-228U-market2json:~/market2json#

Step 3) Finished

Database should now be cleared