|
| 1 | +––– input ––– |
| 2 | +apt-get install -y jq > /dev/null; echo $? |
| 3 | +––– output ––– |
| 4 | +debconf: delaying package configuration, since apt-utils is not installed |
| 5 | +0 |
| 6 | +––– input ––– |
| 7 | +export INSTANCE=1 |
| 8 | +––– output ––– |
| 9 | +––– input ––– |
| 10 | +mkdir -p /var/{run,lib,log}/manticore-${INSTANCE} |
| 11 | +––– output ––– |
| 12 | +––– input ––– |
| 13 | +stdbuf -oL searchd -c test/clt-tests/base/searchd-with-flexible-ports.conf > /dev/null |
| 14 | +––– output ––– |
| 15 | +––– input ––– |
| 16 | +if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore-${INSTANCE}/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore-${INSTANCE}/searchd.log;fi |
| 17 | +––– output ––– |
| 18 | +Buddy started! |
| 19 | +––– input ––– |
| 20 | +export INSTANCE=2 |
| 21 | +––– output ––– |
| 22 | +––– input ––– |
| 23 | +mkdir -p /var/{run,lib,log}/manticore-${INSTANCE} |
| 24 | +––– output ––– |
| 25 | +––– input ––– |
| 26 | +stdbuf -oL searchd -c test/clt-tests/base/searchd-with-flexible-ports.conf > /dev/null |
| 27 | +––– output ––– |
| 28 | +––– input ––– |
| 29 | +if timeout 10 grep -qm1 '\[BUDDY\] started' <(tail -n 1000 -f /var/log/manticore-${INSTANCE}/searchd.log); then echo 'Buddy started!'; else echo 'Timeout or failed!'; cat /var/log/manticore-${INSTANCE}/searchd.log;fi |
| 30 | +––– output ––– |
| 31 | +Buddy started! |
| 32 | +––– input ––– |
| 33 | +export CLUSTER_NAME=replication |
| 34 | +––– output ––– |
| 35 | +––– input ––– |
| 36 | +mysql -h0 -P1306 -e "CREATE CLUSTER ${CLUSTER_NAME}" |
| 37 | +––– output ––– |
| 38 | +––– input ––– |
| 39 | +mysql -h0 -P1306 -e "SHOW STATUS LIKE 'cluster_${CLUSTER_NAME}_status'\G" |
| 40 | +––– output ––– |
| 41 | +*************************** 1. row *************************** |
| 42 | +Counter: cluster_replication_status |
| 43 | + Value: primary |
| 44 | +––– input ––– |
| 45 | +for n in `seq 2 $INSTANCE`; do mysql -h0 -P${n}306 -e "JOIN CLUSTER ${CLUSTER_NAME} AT '127.0.0.1:1312'"; done; |
| 46 | +––– output ––– |
| 47 | +––– input ––– |
| 48 | +mysql -h0 -P${INSTANCE}306 -e "SHOW STATUS LIKE 'cluster_${CLUSTER_NAME}_status'\G" |
| 49 | +––– output ––– |
| 50 | +*************************** 1. row *************************** |
| 51 | +Counter: cluster_replication_status |
| 52 | + Value: primary |
| 53 | +––– input ––– |
| 54 | +for port in 1306 2306; do echo "Checking status for port $port:"; timeout 10 bash -c "while ! mysql -h0 -P$port -e \"SHOW STATUS LIKE 'cluster_replication_node_state'\G\" | grep -q 'Value: synced'; do sleep 1; done" && echo "Port $port: Node is synced." || echo "Port $port: Node is not synced (Value: closed or other)."; done |
| 55 | +––– output ––– |
| 56 | +Checking status for port 1306: |
| 57 | +Port 1306: Node is synced. |
| 58 | +Checking status for port 2306: |
| 59 | +Port 2306: Node is synced. |
| 60 | +––– input ––– |
| 61 | +mysql -h0 -P1306 -e "CREATE TABLE replication:test2 (id BIGINT, name TEXT) SHARDS='3' RF='2';"; echo $? |
| 62 | +––– output ––– |
| 63 | +0 |
| 64 | +––– input ––– |
| 65 | +mysql -h0 -P1306 -e "show create table test2 option force=1" |
| 66 | +––– output ––– |
| 67 | ++-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 68 | +| Table | Create Table | |
| 69 | ++-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 70 | +| test2 | CREATE TABLE test2 type='distributed' agent='127.0.0.1:1312:system.test2_s0|127.0.0.1:2312:system.test2_s0' agent='127.0.0.1:1312:system.test2_s1|127.0.0.1:2312:system.test2_s1' agent='127.0.0.1:1312:system.test2_s2|127.0.0.1:2312:system.test2_s2' | |
| 71 | ++-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 72 | +––– input ––– |
| 73 | +mysql -h0 -P1306 -e "SHOW TABLES FROM SYSTEM\G" | grep Table | cut -d' ' -f2 |
| 74 | +––– output ––– |
| 75 | +system.sharding_queue |
| 76 | +system.sharding_state |
| 77 | +system.sharding_table |
| 78 | +system.test2_s0 |
| 79 | +system.test2_s1 |
| 80 | +system.test2_s2 |
| 81 | +––– input ––– |
| 82 | +mysql -h0 -P2306 -e "SHOW TABLES FROM SYSTEM\G" | grep Table | cut -d' ' -f2 |
| 83 | +––– output ––– |
| 84 | +system.sharding_queue |
| 85 | +system.sharding_state |
| 86 | +system.sharding_table |
| 87 | +system.test2_s0 |
| 88 | +system.test2_s1 |
| 89 | +system.test2_s2 |
| 90 | +––– input ––– |
| 91 | +curl -s -X POST http://localhost:1308/insert -d '{"cluster": "replication", "table": "test2", "id": 1, "doc": {"name": "iPhone 13 Pro"}}' | jq '.result' |
| 92 | +––– output ––– |
| 93 | +"created" |
| 94 | +––– input ––– |
| 95 | +curl -s -X POST http://localhost:1308/insert -d '{"cluster": "replication", "table": "test2", "id": 2, "doc": {"name": "iPhone 14 Pro"}}' | jq '.result' |
| 96 | +––– output ––– |
| 97 | +"created" |
| 98 | +––– input ––– |
| 99 | +mysql -h0 -P1306 -e "SELECT * FROM test2 ORDER BY id ASC;" |
| 100 | +––– output ––– |
| 101 | ++------+---------------+ |
| 102 | +| id | name | |
| 103 | ++------+---------------+ |
| 104 | +| 1 | iPhone 13 Pro | |
| 105 | +| 2 | iPhone 14 Pro | |
| 106 | ++------+---------------+ |
| 107 | +––– input ––– |
| 108 | +mysql -h0 -P1306 -e "SELECT count(*) FROM test2;" |
| 109 | +––– output ––– |
| 110 | ++----------+ |
| 111 | +| count(*) | |
| 112 | ++----------+ |
| 113 | +| 2 | |
| 114 | ++----------+ |
| 115 | +––– input ––– |
| 116 | +mysql -h0 -P2306 -e 'DESC system.test2_s2 OPTION force=1' |
| 117 | +––– output ––– |
| 118 | ++-------+--------+----------------+ |
| 119 | +| Field | Type | Properties | |
| 120 | ++-------+--------+----------------+ |
| 121 | +| id | bigint | | |
| 122 | +| name | text | indexed stored | |
| 123 | ++-------+--------+----------------+ |
| 124 | +––– input ––– |
| 125 | +mysql -h0 -P2306 -e "SHOW STATUS LIKE 'cluster_e3d112439806feecd6da4d4cb4544210_status'\G" |
| 126 | +––– output ––– |
| 127 | +*************************** 1. row *************************** |
| 128 | +Counter: cluster_e3d112439806feecd6da4d4cb4544210_status |
| 129 | + Value: primary |
| 130 | +––– input ––– |
| 131 | +cp /var/log/manticore-2/query.log /tmp/query.log |
| 132 | +––– output ––– |
| 133 | +––– input ––– |
| 134 | +curl -s -X POST http://localhost:1308/update -d '{"cluster": "replication", "table": "test2", "id": 2, "doc": {"name": "iPhone 15 Pro"}}' |
| 135 | +––– output ––– |
| 136 | +––– comment ––– |
| 137 | +Get lines that added to query log after snapshot on the crash |
| 138 | +––– input ––– |
| 139 | +tail -n +$(wc -l /tmp/query.log | awk '{print $1}') /var/log/manticore-2/query.log |
| 140 | +––– output ––– |
| 141 | +––– input ––– |
| 142 | +mysql -h0 -P2306 -e "SHOW STATUS LIKE 'cluster_e3d112439806feecd6da4d4cb4544210_status'\G" |
| 143 | +––– output ––– |
| 144 | +*************************** 1. row *************************** |
| 145 | +Counter: cluster_e3d112439806feecd6da4d4cb4544210_status |
| 146 | + Value: primary |
| 147 | +––– input ––– |
| 148 | +sleep 1; grep -ia 'FATAL' -A1000 /var/log/manticore-2/searchd.log |
| 149 | +––– output ––– |
| 150 | +––– input ––– |
| 151 | +cat /var/log/manticore-2/query.log |
| 152 | +––– output ––– |
| 153 | +––– input ––– |
| 154 | +mysql -h0 -P2306 -e 'DESC system.test2_s2 OPTION force=1' |
| 155 | +––– output ––– |
| 156 | ++-------+--------+----------------+ |
| 157 | +| Field | Type | Properties | |
| 158 | ++-------+--------+----------------+ |
| 159 | +| id | bigint | | |
| 160 | +| name | text | indexed stored | |
| 161 | ++-------+--------+----------------+ |
0 commit comments