![]() If you already have psql you could run psql -U materialize -h localhost -p 6875 materialize instead. This is just a shortcut to a Docker container with postgres-client pre-installed. In order to Launch the Materialize CLI, you can run the following command: docker-compose run mzcli Let's start by first running the Redpanda container: docker-compose up -d redpandaįinally, start all of the services: docker-compose up -d How to Run the Demoįirst, start by cloning the repository: git clone Īfter that you can access the directory: cd materialize-tutorials/mz-join-mysql-and-postgresql ![]() ![]() I just like the simplicity that Redpanda brings to the table, as you can run a single Redpanda instance instead of all of the Kafka components. You could, later on, use the information from that new topic to send out notifications to your users and remind them that they have an abandoned cart.Īs a side note here, you would be perfectly fine using Kafka instead of Redpanda.At the end we will use Metabase to visualize the data.We will then create a sink to send the abandoned cart data out to a new Redpanda topic.In Materialize we'll join our orders and users together, do some filtering, and create a materialized view that shows the abandoned cart information.We'll then ingest this Redpanda topic into Materialize directly along with the users from the Postgres database.We'll also have a Postgres database where we can get our users.As the database writes occur, Debezium streams the changes out of MySQL to a Redpanda topic.The orders will be stored in a MySQL database.A mock service to continually generate orders.In case that you don't have Docker and Docker Compose already installed, you can follow the official instructions on how to do that here:Īs shown in the diagram above, we will have the following components: The architecture of the demo project is as follows: PrerequisitesĪll of the services that we will be using in the demo will run inside Docker containers, that way you will not have to install any additional services on your laptop or server rather than Docker and Docker Compose. It'll generate events that could, later on, be used to send notifications when a cart has been abandoned for a long time. The demo project that we are going to use will monitor the orders on our mock website. The tutorial includes a demo project which you can start using docker-compose. Materialize is a source-available streaming database written in Rust that maintains the results of a SQL query (a materialized view) in memory as the data changes. We'll then be able to query that directly and get results back from both databases in real-time using standard SQL. In this tutorial, we will be using Materialize to join MySQL and Postgres in a live materialized view. But this would increase the complexity of the system. Usually, to join the data from the two databases, you would have to introduce a new microservice that would join the data together. When you're working on a project that consists of a lot of microservices, it'll likely also include multiple databases.įor example, you might have a MySQL database and a PostgreSQL database, both running on separate servers.
0 Comments
Leave a Reply. |