Showing posts with label article. Show all posts
Showing posts with label article. Show all posts

Friday, January 18, 2008

Free New FactorySQL™ UDP Monitor Plugin Available With Source Code

SACRAMENTO, CA SEPTEMBER 7, 2007 - A new FactorySQL plugin to monitor UDP messages is now available, with source code, from the plugins section of the Inductive Automation website. This free plugin allows FactorySQL to monitor any number of ports for UDP packets, and makes the data received available through an action item expression function.

The ability to monitor UDP packets can be very useful in many applications, including bar code scanners, printers, PLC messaging, and more. The full source code of the plugin is included in the download, allowing users to adapt and enhance the functionality for their own needs.

To download, please visit http://www.inductiveautomation.com/products/plugins/

Top 10 Reasons to Switch to Inductive Automation

SACRAMENTO, CA JULY 12, 2007 - Thinking about trying out FactorySQL™ and FactoryPMI™ by Inductive Automation? Here's the top 10 reasons you should take the plunge.

10. Leverage Existing Infrastructure. Inductive Automation’s software integrates with your existing SQL database, talks to your existing PLCs using OPC, and runs on commodity I.T. infrastructure.
9. Remember Everything. Modern SQL databases have virtually unlimited storage abilities. Have your plant history at your fingertips.
8. Make Friends with I.T. I.T. departments already know how to support and maintain our software, because it uses modern, standard technologies. This familiarity translates to enthusiastic project endorsement from I.T.: crucial to an enterprise integration project’s success.
7. Never Lose Control. Have a mission critical process that you need to control? With the simplest, most reliable redundancy architecture on the market, you’ll rest well knowing that you’ll always be in control.
6. Get Started Quickly. Download our fully functional software this morning and start logging data to your database with FactorySQL™ minutes after installation. Whats more, you'll be launching your FactoryPMI™ based SCADA project enterprise-wide by this afternoon, with the ease of web-launching and the safety of industry-standard security.
5. Turn Data into Information. SQL databases are great at storing loads of data. FactoryPMI™ is great at turning that data into valuable information. Get unprecedented information analysis capabilities with the industry’s most advanced charts, tables, alarm history, and PDF reporting.
4. Straight-Forward Licensing. Our per-server licensing couldn’t be simpler. No inch-thick product book to wade through, no secret pricing games, no run-around.
3. Top-Notch Tech Support. Our users absolutely rave about our tech support, and we’re proud of it. We care about your success with our products. On multiple occasions users have offered to buy our technicians dinner! That’s the Inductive Automation difference.
2. Launch Everywhere. Our innovative web-launch technology allows you to launch full-featured rich FactoryPMI™ SCADA clients on any computer on your network. Unlike any deployment system you’ve seen, once you use web-launch, you’ll never go back to another SCADA system again.
1. Save Money. Lots of Money. Our software is very affordable. Sold by the server with unlimited tags, screens, projects, PLCs, database connections, etc. We save our customers hundreds of thousands of dollars in software costs. Switch to Inductive Automation and create the SCADA application of your dreams for less than you ever thought possible.

How To: Setup FactorySQL Alert Distribution Lists

SACRAMENTO, CA JULY 12, 2007 - This article demonstrates how to setup email alert distribution lists in FactorySQL. For this example, we will show how to setup a severity based list, a group based list and a shift based list.

Background


Alert Distribution lists allow you to define Groups and Contacts, and rules that define when contacts receive various alerts.

A group has an expression that defines which alert it will receive. Whenever an alert occurs that passes the group's expression, an email is sent to all contacts who belong to that group.
The expression is the same as an action item expression, and can use all of the functions and operators available to them. Unlike action items, the distribution group expression can refer to the properties of an alert, such as its Value, Time, Severity, Group Name, etc.

A contact consists of a name and email address, and a list of groups that they belong to.
Note: only one email will be sent to each contact per alert, therefore it is OK to have contacts that are members of groups whose expressions may overlap.

Getting Started

First, we need turn on alerting in FactorySQL. Open up the FactorySQL frontend and select Settings -> Alert Settings. Once there select a Log connection, which will be the database FactorySQL uses to store alerts. Next, give FactorySQL two table names, a log table and a status table. Make sure the System Behavior is set to Standard. Lastly, click the checkbox Send an email to the following addresses when an alert occurs and fill out the bottom portion giving the Mail Server, Port, etc. Once you are done hit OK. FactorySQL will automatically create the log table and status table in your database.

Here is an example:

Next, select Distribution Lists under Alert Settings on the left. Again, tell FactorySQL what database you want to store the groups and contacts in by selecting the connection under Data Connection. Now we are ready to start configuring our lists.Here is an example:

To learn how to setup individual alerts please consult the FactorySQL user manual.
Severity Based List



In the Alert Distribution Lists section add a new group and call it Severity Group. Now, we need to write an expression that deals with an alert's severity. For this group, let's send out emails when the severity is Medium which translates to a value of 2.
Translations:
Low = 0
Low-Medium = 1
Medium = 2
Medium-High = 3
High = 4

This is what the expression will look like:
{[SEVERITY]} = 2
Enter this code into the expression and save the group. The group will look like this:

That's it! Now when an alert occurs and its severity is Medium an email will be sent out to all of the contacts in the Severity Group.

Group Based List


In the Alert Distribution Lists section add a new group and call it Group. Now, we need to write an expression that deals with an alert's group name. For this group, let's send out emails when the group name is "Test Group".
This is what the expression will look like:

{[GROUP_NAME]} = "Test Group"
Enter this code into the expression and save the group. The group will look like this:

That's it! Now when an alert occurs and it is inside the group "Test Group" an email will be sent out to all of the contacts in the Group.

Shift Based List


In the Alert Distribution Lists section add a new group and call it Shift Group. Now, we need to write an expression that deals with an alert's time. For this group, let's send out emails to a shift that runs from 8:00 AM to 1:00 PM.
This is what the expression will look like:
TimeBetween({[TIME]}, "8:00 am", "1:00 pm")

Enter this code into the expression and save the group. The group will look like this:

That's it! Now when an alert occurs and its time is between 8:00 AM and 1:00 PM an email will be sent out to all of the contacts in the Group.
More Information


Please consult the FactorySQL user manual for more information on the properties available to expressions. Also, you can combine groups above into a single group using the && operator in the expression. So, you could have an expression like this:
{[GROUP_NAME]} = "Test Group" && {[SEVERITY]} = 2
Here an email will be sent out when the alert's group name is Test Group and the severity is medium.

If you want to configure the alert distribution lists inside of the FactoryPMI look at the Alert Distribution lists goodie located here.

How To: Use FactoryPMI Gateway On 2 Closed Networks

SACRAMENTO, CA JUNE 5, 2007 - This article explains how to set up a FactoryPMI Gateway that needs to be accessible from 2 separate private networks on different adapters.

Many industrial controls systems have been set up as 2 separate networks; the corporate subnet has local server and Internet access, while the controls subnet houses the PLCs and HMI systems. SCADA applications, especially as you get into reporting, MES, and ERP, often need to access both sides. These setups typically have computers with 2 network cards, one attached to each network. This is called a multihomed host. This article describes how to configure FactoryPMI on a multihomed computer.

We don't recommend this type of setup, especially since they were often configured without care. In critical production facilities it's not uncommon to see IP addresses like 1.2.3.4 (random routable addresses) or subnet masks that show that the engineer had no idea what they do. That was fine when industrial sites were isolated. Now that Internet access is becoming universal, this kind of practice borders somewhere between sloppy and unprofessional. Additionally, SCADA security is a hot and important area of Homeland Security.

Background




The FactoryPMI Gateway needs to be able to tell runtime clients its single address to communicate over. This is important for clustering and reconnection, even if there is only one Gateway. The address is set as the HTTP Address in the Network section of the Gateway Configuration page. If set to autodetect, the Gateway will choose one IP address, and runtime clients will only work if they can contact the Gateway via that address - in most cases one network will work and the other will not! If autodetect is unchecked it can be set to an IP address (for example 192.168.0.55), a hostname or NetBIOS name (sn25p), or a fully registered domain name (fpmi.inductiveautomation.com).




Determining the Gateway address and problem



On a working FactoryPMI client menu go to help->About FactoryPMI. This is most simply done on the FactoryPMI Gateway machine. You will see the FPMI Gateway location. This is the address that the FactoryPMI Gateway gives clients for communication. If a client can not connect to the Gateway over this address it won't be able to run a project.



You should always be able to pull up the Gateway Configuration web page - the Gateway (web server) listens over all IP addresses and interfaces. The common problem that you may see is that launching the client on one network works and the other fails. On the failed network it will load as if everything were fine, but then give you an error message right before logging in. Possible errors that you may see are Error Loading Plugins or Error downloading project data.


Getting FactoryPMI working on both networks



Getting both networks running is as simple as telling both networks a name or address that they each recognize. The easiest way to accomplish this is to simply use a the computers hostname or NetBIOS name. Name resolution can work in a number of ways. The easiest way to determine if it will work is by opening a DOS prompt and the client and pinging the Gateway by that address. If you get a response, you're good on that network. Repeat for both networks.



In most cases this will resolve seemingly magically by broadcast. If client and Gateway use the same WINS server, this should always work. If you have control of your own DNS servers you can add an "A" record, but Dynamic DNS might resolve it automatically. In the worst case you can always add manual hostname to IP address mappings in the HOSTS or LMHOSTS file of the local client.


Success! You should now be able to run your FactoryPMI clients from either network!

Naive 2 network setup usually = bad idea




The "separate networks" concept for security is a good idea. You should consider putting a computer on both networks to be the same (or worse) than putting a router in between the networks as far as security is concerned. It can be done securely or insecurely, but should not be plugged in carelessly. This type of setup isn't the best solution, but it's cheap and easy, and therefore common. Here are a few reasons that this type of setup should eventually become a relic of times passed:


  • A properly configured router (can be a PC) can isolate both subnets, routing traffic for certain designated nodes, identified by MAC address. This provides a single, configurable, secure, point. Each node needs only one Ethernet adapter and IP address. A layer 3 switch is ideal for this application.

  • Even home Ethernet switches provide enough bandwidth so that one side will not bog down the other. QOS (quality of service) and other performance options exist. If the PLC side truly needs realtime or deterministic performance, or the corporate network is huge, you'll probably be using other equipment and have a knowledgeable IT staff.

  • It's now standard to use non-routable IP addresses and NAT behind a firewall for the corporate network. Companies no longer provide real (Internet accessible) addresses for each computer. In most cases this a sufficient starting point with respect to security, for the controls network. If it's not, you should be using an IT department instead of a tacky workaround. Your efforts are better spent password protecting the PLCs and securing the firewall.


The point to take away is that a closed (controls) network is about as secure as you can get. It no longer remains closed when you bridge it to another network. Don't kid yourself into thinking that the networks are still isolated when you have that one computer with 2 ethernet cards plugged into each. As you add computers to both networks or make your SCADA system more distributed, which is the trend for corporate access, the security of this 2 networks concept disappears. If you need security, standard IT technology has this problem figured out. There is nothing inherently "bad" about a multihomed system - it's something that you should strive to learn more about if you wish to implement one. Industrial software users and systems integrators alike should become proficient with IT basics.

Summary
We learned that FactoryPMI can be easily set up to work in a multihomed setup. We considered that networking technologies exist to properly segment and secure our traffic.

Here's how we setup a FactoryPMI Gateway to work with multiple networks:
  • Verified that name resolution works on both networks

  • In the Network section of the Gateway Configuration page, set a hostname as the http address

Integrator Highlight: Widaq Systems LLC

SACRAMENTO, CA MAY 1, 2007 - This month we interviewed Anthony Purdom of Widaq systems about their
first project for McDougall & Sons Inc. Widaq specializes in high-tech data acquisition systems in the agricultural sector.

IA: What does Widaq offer for its customers?

Tony: WiDAQ Systems provides the Northwest Agricultural Industry with cutting edge SCADA technologies. Our goal is to help agricultural crop producers improve operational effectiveness through enhanced visibility of business operations. Through the application of state-of- the-art Wireless Sensor Networks for data acquisition and web distributed interface for data visualization, we provide decision makers with global on-line access to high resolution operational data.

Our primary products are integration services and network engineering. We're also marketing a product, a whole system wireless sensor network, for data acquisition in tree fruit orchards and grape vineyards.

IA: Could you describe a job that you've done with Inductive Automation Software?

Tony: McDougals was the first. We have 4 orchards online now - spread out in central Washington in remote locations. We've had to do some creative things with Internet connections to make this work. The customer wanted to monitor orchard temperatures in realtime, primarily for frost control. We gave them a higher resolution picture of what was going on in the field, a microclimate throughout the orchard instead of a single temperature probe. There are 2 pieces to the system - wireless sensor networks and Internet connections to acquire data that logs to the central office, and the data logging and analysis system. The second is part is what we've done with FactorySQL and FactoryPMI. They're talking about expanding to as many as 10 other orchards for temperature monitoring. On top of that, your system will allow us to introduce other sensor types: Leaf wetness, relative humidity, soil moisture (for saving water), fruit surface temperature (for preventing sunburn on Apples, saving water on evaporation control systems). They want to add output capabilities to their FactoryPMI system for controlling irrigation values, wind machines, and integration.

IA: How have you used IA software to accomplish this task?

Tony: It's allowed me to very easily bring the data in and build the database without having to be a DBA or programmer. FactorySQL even built the all tables. I then created an interface for our executive managers here in the office, and the orchard managers at each location. They can watch those realtime values and I didn't have to set up a complex computer system. They just need a basic PC with an Internet connection. They use laptops with wireless data cards.

One of the big advantages with your product is that I can easily make changes on a system that's 2 1/2 hours away. I can't drive to each site to upgrade software all the time. The web distribution has really made that a non-issue.

IA: Do you use alerting in FactorySQL?

Tony: We're sending emails (text messages) to orchard managers' cell phones. That's another really valuable piece of the system that they hadn't had before. Typically, a frost event happens in the middle of the night, so having that additional notification is important to them. They then run wind machines in the field. The clear message is just as important as the alarm - it shows that their frost control is working and that they can start turning things off. Between the better picture provided by multiple sensors and the accurate realtime view, they have a much better picture of the orchard.

Prior to this system someone would have to be there to check alcohol temperatures - taking a half hour to get through the orchard, until someone determines that it's warm enough to shut off the machine. Now they can see what's going on in realtime throughout the entire orchard by checking on a laptop, ultimately saving them money on fuel and allowing them to be more precise with their frost control.Their existing HMI had some trending capabilities, but couldn't get the data out to spreadsheets or SQL databases without additional licensing.

IA: What do you think about the trending in FactoryPMI?

Tony: They've been happy with it. They keep temperature records at the time that they spray the particular products. Rather than looking at thermometers, they use the FactoryPMI history graph for their logs. Executive managers look at the entire system each morning allowing them to know what's happened at all the orchards.

IA: How do you use Inductive Automation software at Widaq?

Tony: My whole business is now based on 2 components - wireless sensors and Inductive Automation software that I customize for each customer. These packages have allowed me to provide 2 different levels. One is an entire system that I implement with a server, software, and sensor network, all managed by the customer. The flexibility of your product has given me a second option, which is really awesome for my smaller customers. I provide them with the system, but with FactorySQL and FactoryPMI I can bring the data into my server and provide a product interface. The customer then doesn't have to maintain the server.

I can't say enough good things about Inductive Automation - you have great products that are super flexible! Having the ability to make huge changes to the system that are immediately available to the end user with very little effort - is incredible.

IA: Did you try this with any other packages or custom code?

Tony: I did a lot of research when looking for a backend system. I looked at products from Wonderware and a few others, the big household name automation products, and I couldn't make anything fit well. Specifically I couldn't find anything that interfaced through OPC well - the web interface of FactoryPMI is really what sold it for me.

IA: Is there anything else you would like to say regarding your experience with IA software?

Tony: I could talk about how great it is all day! I've been pleasantly surprised on how flexible, easy, and powerful your software is. I feel like I could build a custom system however the customer wanted with ease. It's pretty amazing!

Here is a screenshot from one of his FactoryPMI projects:

End-User Highlight: Fosters America Group

SACRAMENTO, CA APRIL 4, 2007 - We interviewed a Fosters America Group manager. His mobile bottling trailer,
powered by Inductive Automation software, services the finest wines of Napa Valley.


IA: What do you use Inductive Automation software for?

John: It runs our mobile bottling line. The semi trailer goes all over Napa and Sonoma county. I'm not always with the trailer, but I always want to be able to access process information. It logs production totals, CIP (clean in place) cycles, and user input. I can pull up any info including realtime values from anywhere. We're still in the development stage. Eventually I want to integrate our maintenance and more. We want the most advanced mobile bottling trailer there is.

IA: What is a mobile bottling line?

John: Imagine a complete bottling line inside a semi trailer. They connect a hose where the wine comes in, out goes bottled, labeled wine. We do about eighty bottles per minute. We're not the only mobile bottling line around, they're common for smaller wineries who only bottle a couple of times per year. The difference is that ours does the best wines Fosters makes. Owning our own mobile bottling line is actually new to us, we're developing this application to meet our needs for the best wines.


IA: Why would you use a mobile bottling line?

John: We've consolidated our bottling facilities into one large location that services most of our wine. This is efficient and cost effective. Premium, delicate wines, for example, a Private Reserve Cabernet, are bottled on site. The winemaker demands that the wine comes out in exactly the same quality as it went in. They're concerned with the effects of transportation, storage, and the bottling process. The mobile bottling trailer goes to their site and bottles the best wines that Fosters America makes: Beringer, Lindemans, Meridian, Wolf Blass, and many more.

IA: What makes your mobile bottling line different?

John: We don't do anything unique, but have onboard technology and tracking software. We have high quality equipment, but the main difference is that my team has to be very careful. For example, all SOPs are available on the touch screen. They have to acknowledge every step during the bottling process, which is logged to our server. It's not so much to check on my crew but if there is ever a question we can prove exactly what happened. It tells me who did the CIP, when, and gives pertinent info. The team can't bypass the process - and they're trained. They can either go by procedure exactly or abort, which is also logged. There's another thing that's important about this technology. Say there is a failure somewhere. We have the ability to find out what went wrong and correct the procedure. I can even troubleshoot via the PLC from anywhere.

IA: Could you describe some of the technology in your trailer?


John: We have a web server and SQL database in the trailer. A proxycast cell modem allows me to access the realtime process and historical data from anywhere - regardless of where the mobile bottling happens to be. Right now I'm in Napa and it's in St. Helena. I get a report every hour on my cell phone and email since they're producing. I can pull up the process from a web browser. We also have wifi setup even though we can do everything via the proxycast modem.

IA: What can you say about the web based model?

John: That's extremely important; it was the main selling point for us. I wanted to allow anybody in the company go to the web page for information. A winemaker might look at the schedule of the trailer. They can verify that bottling occurred smoothly and view relevant data.

There is a lot of expandability. I'm looking into what Senior VPs who report to Australia are really looking for. They can already bring up the information from any computer, regardless of where the trailer is. I've yet to find anything that the system can't do. The program seems to be easily expanded or modified to suit customer needs.

IA: Is there anything else to say about the Mobile Bottling Line?

John: The mobile line is a showcase. We take pride in our wine and do the best. Remote troubleshooting capabilities are very important. The wine is delicate. Winemakers want their wine in bottles as soon as possible from when they get started. Downtime likely jeopardizes the quality and worries winemakers. That's a bigger point than production. Quality comes first with our wine. If a winemaker is confident in the mobile bottling line, they can focus on their artistry, wine. That's their job and where they excel. When you look at a bottle of wine, it has their name on it. They take that very seriously.

FactoryPMI How To: Turn An Existing PDF Into A Dynamic Report

How To: Turn An Existing PDF Into A Dynamic Report

SACRAMENTO, CA APRIL 4, 2007 - This article demonstrates how to use the FactoryPMI Reporting Plugin to dynamically fill an existing PDF report. For this example, we will fill in a 1040EZ Income Tax Return with data from a MySQL database.


Background



The database we are using for this example is called Accounting. There are two tables inside the database, one called Contacts and one called Income.

The contacts data can be retrieved from the accounting database with the following SQL query:

SELECT C.* FROM Contacts C ORDER BY C.ID;




The income data can be retrieved from the accounting database with the following SQL query:

SELECT I.* FROM Income I ORDER BY I.ContactID;



You can retrieve the combined data for the first contact with the following query:

SELECT C.*, I.* FROM Contacts C, Income I WHERE C.ID = I.ContactID AND C.ID = 1;
Getting Started



Begin by installing the Reporting Plugin in the FactoryPMI Gateway Configuration under the section labeled Plugins. Once you have the plugin installed open up the FactoryPMI Designer and select the project you want to configure. Now create a new window and drag down a Report Viewer from the Reporting tab. Next, populate the Data dynamic dataset property by binding it to the combined sql query from the last section. Now click on the Customizer (Cntl+U) button to start designing the report.



Creating the Report



First drag and drop an existing PDF from Windows into your report designer. This will make the existing PDF the background of your report.



Now, select the Keys tab on the right hand side of the report designer. Next, select Data and then drag and drop the Firstname key into the report. It is as simple as that!




Finish dragging in all of the keys for the report. You can even do dynamic calculations inside the report as well. Once you are done click OK and the report will look like this:



Learn more about the FactoryPMI Reporting Plugin

Setting up MySQL database replication

SACRAMENTO, CA MARCH 1, 2007 - This article describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases are in sync. This is not a backup policy because an accidentally issued DELETE command will also be carried out on the slave; but replication can help protect against hardware failures.

Here we will show how to replicate the database exampledb from the master with the IP address 192.168.1.100 to a slave. Both systems (master and slave) are running Microsoft Windows; however, the configuration should apply to all distributions with little or no modification.

Both systems have MySQL 5.0 installed, and the database exampledb with tables and data is already existing on the master, but not on the slave.

Step 1: Configure the Master



First we have to edit the file C:\Program Files\MySQL\MySQL Server 5.0\my.ini. We have to enable networking for MySQL, and MySQL should listen on all IP addresses, therefore we comment out these lines (if existant):

#skip-networking
#bind-address = 127.0.0.1


Now we have to tell MySQL to write logs (these logs are used by the slave to see what has changed on the master), which log file it should use, and we have to specify that this MySQL server is the master. Put the following lines into the file C:\Program Files\MySQL\MySQL Server 5.0\my.ini below the [mysqld] line:


log-bin = "C:\Program Files\MySQL\MySQL Server 5.0\data\mysql-bin.log"
binlog-do-db=exampledb
server-id=1


Then we restart the MySQL service by running the following commands in the Command Prompt (located at Start -> All Programs -> Accessories -> Command Prompt):

net stop mysql
net start mysql



Then we need to change directory to our MySQL bin directory by running the following command in Command Prompt:

cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"

Now we log into the MySQL database as root and create a user with replication privileges:

mysql -u root -p
Enter password:


Now we are in the MySQL shell. Issue the following commands.

GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY '<some_password>';
(Replace <some_password> with a real password!)
FLUSH PRIVILEGES;


Next (still in the MySQL shell) do this:


USE exampledb;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;


The last command will show something like this:




Write down this information, we will need it later on the slave!


Then leave the MySQL shell:

exit;

Now we need to make a database dump of the master. In the Command Prompt run the following command:

mysqldump -u root -p<password> --opt exampledb > exampledb.sql
(Replace <password> with the real password for the MySQL user root! Important: There is no space between -p and <password>!)


This will create an SQL dump of exampledb in the file exampledb.sql. Transfer this file to your slave server.

Finally we have to unlock the tables in exampledb:

mysql -u root -p
Enter password:
UNLOCK TABLES;
quit;


Now the configuration on the master is finished.

Step 2: Configure the Slave



On the slave we first have to create the database exampledb in the Command Prompt:


cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"
mysql -u root -p
Enter password:
CREATE DATABASE exampledb;
exit;



Now we need to import the SQL dump into our newly created exampledb on the slave:

mysql -u root -p<password> exampledb < "C:\path\to\exampledb.sql"
Next we have to tell MySQL on the salve that it is the slave, that the master is 192.168.1.100. Therefore we add the following lines to C:\Program Files\MySQL\MySQL Server 5.0\my.ini below the [mysqld] line:

server-id=2
master-host=192.168.1.100
master-user=slave_user
master-password=secret
master-connect-retry=60
replicate-do-db=exampledb


Then we restart MySQL:

net stop mysql
net start mysql


Finally, we must do this:
mysql -u root -p
Enter password:
SLAVE STOP;


In the next command (still on the MySQL shell) you have to replace the values appropriately:

CHANGE MASTER TO MASTER_HOST='192.168.1.100', MASTER_USER='slave_user', MASTER_PASSWORD='<some_password>', MASTER_LOG_FILE='mysql-bin.006', MASTER_LOG_POS=183;

  • MASTER_HOST is the IP address or hostname of the master (in this example it is 192.168.1.100).


  • MASTER_USER is the user we granted replication privileges on the master.

  • MASTER_PASSWORD is the password of MASTER_USER on the master.

  • MASTER_LOG_FILE is the file MySQL gave back when you ran SHOW MASTER STATUS; on the master.


  • MASTER_LOG_POS is the position MySQL gave back when you ran SHOW MASTER STATUS; on the master.


Now all that is left to do is start the slave. Still on the MySQL shell we run:
START SLAVE;
exit;


That's it! Now whenever exampledb is updated on the master, all changes will be replicated to exampledb on the slave.