environmentd-debug-zip 1.1 KB

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. # Copyright Materialize, Inc. and contributors. All rights reserved.
  3. #
  4. # Use of this software is governed by the Business Source License
  5. # included in the LICENSE file at the root of this repository.
  6. #
  7. # As of the Change Date specified in that file, in accordance with
  8. # the Business Source License, use of this software will be governed
  9. # by the Apache License, Version 2.0.
  10. #
  11. # environmentd-debug-zip — gather local environment's state into a zip file.
  12. set -euo pipefail
  13. postgres=${MZDEV_POSTGRES:-postgres://root@localhost:26257/materialize}
  14. echo "Shutting down running environmentd and clusterd (if any)"
  15. killall -q environmentd clusterd || true
  16. mkdir -p mzdata/pgdump
  17. for i in consensus.consensus storage.collections storage.data storage.fence storage.sinces storage.uppers tsoracle.timestamp_oracle adapter.collections adapter.data adapter.fence adapter.sinces adapter.uppers; do
  18. echo "Exporting ${i} from CockroachDB"
  19. psql "${postgres}" -q --csv -c "select * from ${i}" > mzdata/pgdump/"${i}.csv"
  20. done
  21. zip -qr mzdata/debug.zip mzdata --exclude debug.zip
  22. echo "Bundled environmentd debug data into ./mzdata/debug.zip"