Month: January 2020

Developers

Altering big tables in mySQL

Altering a big-sized table is never a fun task. It can cause the table to lock for anywhere between a couple of minutes to a couple of hours. If the table is an essential part of your production environment, this could pose a major challenge.

Couple of scenarios for such change can be:
1. Add column
2. Drop column
3. Add an index
4. Update an index
This situation happens to me every now and then and I came up with a very easy solution and while the solution I provide is not fully downtime-free, it minimizes downtime as much as possible. You can be up and running again within 5 minutes. It is also much simpler than many other solutions I Googled. If you cannot accept even 5 minutes of downtime, continue Googling…
In this post I will explain how to alter a table while the DB is hosted as an RDS instance on AWS. This process is very easy using AWS RDS but it can be done on any other cloud provider or on premise.
Step 1: Set the Binlog Format
Binlog is where each action in the DB is saved. You can control how it is saved by changing the “binlog format”.
If you don’t already have a separate parameter group for your DB, create one and assign it to your DB. If you are using the RDS default, just clone it and assign the clone to your instance.
We now need to set the binlog format.
Statement — It will save each query, I.E: “Update users set name=’tal’ where id = 1”.
Row — It will save the data that changed to the binlog
Mixed — Let mySQL choose what to save.
Usually the default is Mixed which is ok for most scenarios, but on some occasions, you may want to change it if Mixed is failing. You will see that your replication is failing once you start changing the table. Notice that after each change you must reset the DB which will cause additional downtime.
Step 2: Replication
Create a read replica of the DB. Make sure to make the replica to be the same as your production. I.E, if you are using Multi-AZ, your replica should be Multi-AZ as well.
Step 3: Change the parameter group of the replica
Clone the parameter group of the production server and create a new one.
Change the “read_only” parameter to 0.
You can now work on the replica.
Step 4: Change the table
On the replica server, change the table. If a large amount of data is going into the table from the production server, this step will lock the table and will block the whole replication.
Once it is finished (can also take days, depends on the size of the table), the replication should continue automatically, and you should give it time to catch up.
You can monitor the progress using the “show slave status” command on the replica server or through the RDS admin.
In the command, you are looking to monitor the “Last_Error” field to see if something interrupts the replication and the “Seconds_Behind_Master” in order to see that both servers are up to date and syncing (should be 0).
Step 5: Switch replica back to the original parameters group.
Once the replica is syncing again, return the production parameters group to the replica — this will active again the read only.
Step 6: 5 minutes of downtime
It is now the moment of truth. The following process can be done in 5 minutes:
1. Modify the production instance. Change the name of the instance to be something else. This will cause the endpoint of the instance to be changed and will shut down your code environment.
2. Once the change is finished, it means that no new data is coming into the DB. Select the replica and under actions choose “promote read replica”. This will cause the replica to become a new standalone instance, separate of the replication..
3. Modify the name of the replica instance to the original name of the production instance. Once finished, everything will return to normal and you will have a new production instance with the same data but with a modified database.
4. You can now go ahead and delete the old instance or keep it for couple of days just in case.

Tal Weksler
Posted by Tal Weksler
Company News

Fieldin Selected to John Deere Startup Collaborator Program

MOLINE, Illinois (January 23, 2020) – Deere & Company today announced Fieldin has been selected to participate in its Intelligent Solutions Group’s Startup Collaborator program for 2020.

Fieldin was one of four agtech companies selected to the program, including DataFarm, FaunaPhotonics and EarthSense.

According to Deere, the program was launched last year to “enhance and deepen collaborative relationships with startup companies whose technology could add value for John Deere customers.”

“We’re excited because we already do a lot of work with John Deere, working hand-in-hand with their dealers and customers to provide an actionable data layer to their specialty crop equipment,” said Fieldin CEO Boaz Bachar. “We look forward to building on that relationship and evolving our Control Center with the help of Deere, their Intelligent Solutions Group, their tractor group and their trusted dealers.”

Founded in 2013, Fieldin’s Control Center helps specialty crop growers leverage real-time data to manage and optimize spray applications, harvest activities and other critical field activities across their operation.

“The first year of the John Deere Startup Collaborator program showed us and the startups involved the tremendous mutual value of working closely together,” said Julian Sanchez, director of strategy and business development for Deere’s Intelligent Solutions Group. “We’re excited to continue building on the program’s success.”

The Startup Collaborator provides flexibility for Deere and startups to test innovative technologies with customers and dealers without a more formal business relationship. Startups also gain affiliation with and mentoring from a world-class leader in precision agriculture.

About Deere & Company

Deere & Company (www.JohnDeere.com) is a world leader in providing advanced products and services for customers whose work is linked to the land – those who cultivate, harvest, transform, enrich and build upon the land to meet the world’s dramatically increasing need for food, fuel, shelter and infrastructure.

About Fieldin

Founded by CEO Boaz Bachar and COO Iftach Birger in 2013, Fieldin’s Control Center helps growers manage and optimize spray applications, harvest activities and all other field operations.

Using proprietary sensors and mobile-friendly software, Fieldin’s platform seamlessly connects tractors, machinery and in-field sensors to provide managers with actionable data that improves production, transparency and efficiency across all operations.

To learn more, visit fieldin.com.

Media contact:
info@fieldin.com
(559) 246-1525

Avatar
Posted by Fieldin