-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Integrate VM's guide: add specific commands for Mysql VM #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Jenkins job istio.github.io/presubmit passed |
See also #657 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tech writer review
_docs/guides/integrating-vms.md
Outdated
### Machine admin | ||
First step is to configure the VM sidecar, by adding the service port and restarting the sidecar. | ||
``` | ||
On the VM add ratings database to mysql. To make it easy to visually inspect the difference in the output of the bookinfo application you can change the ratings that are generated by ratings service. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comma after application
_docs/guides/integrating-vms.md
Outdated
# add mysql port to the "ISTIO_INBOUND_PORTS" config | ||
``` | ||
## Registering the mysql service with the mesh | ||
On a host with access to istioctl commands register the VM and mysql db service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a host with access to istioctl
commands, register the VM .."
_docs/guides/integrating-vms.md
Outdated
``` | ||
|
||
Note that the 'db' machine does not need and should not have special kubernetes priviledges. | ||
Note that the 'mysqldb' virtual machine does not need and should not have special kubernetes priviledges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
special Kubernetes privileges.
_docs/guides/integrating-vms.md
Outdated
|
||
## Using the mysql service | ||
|
||
The ratings service in bookinfo will use the DB on the machine. To verify it works, you can | ||
modify the ratings value on the database. | ||
The ratings service in bookinfo will use the DB on the machine. To verify it works, create versio 2 of the ratings service that uses the mysql db on the VM. Then specify route rules that force review service to use the ratings version 2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To verify that it works, create version 2
that force the review service
that's awesome, thanks, can you make the changes Rachael kindly suggested |
Jenkins job istio.github.io/presubmit passed |
_docs/guides/integrating-vms.md
Outdated
@@ -31,34 +31,41 @@ this infrastructure as a single mesh. | |||
[Installation guide]({{home}}/docs/setup/kubernetes/quick-start.html). | |||
|
|||
* Deploy the [BookInfo]({{home}}/docs/guides/bookinfo.html) sample application. | |||
|
|||
* Create a VM named 'db' in the same project as Istio cluster, and [Join the Mesh]({{home}}/docs/setup/kubernetes/mesh-expansion.html). | |||
* Create a VM named 'mysqldb' in the same project as Istio cluster, and [Join the Mesh]({{home}}/docs/setup/kubernetes/mesh-expansion.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the same project as your Istio cluster
(or the Istio cluster) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the name of the VM doesn't (should not) matter; maybe "vm-1" is better to not imply otherwise ?
_docs/guides/integrating-vms.md
Outdated
sudo apt-get update && sudo apt-get install -y mariadb-server | ||
sudo mysql | ||
# Grant remote access by root to db server | ||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with the sidecar this shouldn't be necessary ? (all connections appear to come from localhost) no ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. Just root@localhost should do it.
_docs/guides/integrating-vms.md
Outdated
On the VM add ratings database to mysql. To make it easy to visually inspect the difference in the output of the bookinfo application, you can change the ratings that are generated by ratings service. | ||
```bash | ||
# Add ratings db to the mysql db | ||
curl -q https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/src/mysql/mysqldb-init.sql | sed -e 's/VALUES (\(.*\),.*/VALUES (\1, 1);/g' | sudo mysql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the sed doing ? we can fix the script if there is an issue with it (which issue?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here i am changing the out put so that there is 1 star rating by each reviewer. Without this change it's really hard to know -visually-is the ratings db is generating the output or not.
There is nothing wrong with the data in the db it's just hard to differentiate the outputs compared to the output of non-mysql ratings service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to do that with an update (that can be repeated)
_docs/guides/integrating-vms.md
Outdated
kubectl create -f samples/bookinfo/kube/bookinfo-mysql.yaml | ||
|
||
# Create route rules that will force bookinfo to use the ratings back end | ||
istioctl create -f samples/bookinfo/kube/route-rule-ratings-db.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want the -mysql versions here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bookinfo-mysql.yaml will create a version of the ratings service that is backed my mysql-db.
the route rule 'route-rule-ratings-db.yaml' will send all ratings svc traffic to that version of ratings service.
The 'route-rule-ratings-db' is common to both mongodb and mysqldb.
Jenkins job istio.github.io/presubmit passed |
Jenkins job istio.github.io/presubmit passed |
_docs/guides/integrating-vms.md
Outdated
@@ -31,34 +31,41 @@ this infrastructure as a single mesh. | |||
[Installation guide]({{home}}/docs/setup/kubernetes/quick-start.html). | |||
|
|||
* Deploy the [BookInfo]({{home}}/docs/guides/bookinfo.html) sample application. | |||
|
|||
* Create a VM named 'db' in the same project as Istio cluster, and [Join the Mesh]({{home}}/docs/setup/kubernetes/mesh-expansion.html). | |||
* Create a VM named 'mysqldb' in the same project as Istio cluster, and [Join the Mesh]({{home}}/docs/setup/kubernetes/mesh-expansion.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the name of the VM doesn't (should not) matter; maybe "vm-1" is better to not imply otherwise ?
_docs/guides/integrating-vms.md
Outdated
# Grant access to root | ||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; | ||
quit; | ||
# Allow remote access to mysql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also remove, not needed
_docs/guides/integrating-vms.md
Outdated
On the VM add ratings database to mysql. To make it easy to visually inspect the difference in the output of the bookinfo application, you can change the ratings that are generated by ratings service. | ||
```bash | ||
# Add ratings db to the mysql db | ||
curl -q https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/src/mysql/mysqldb-init.sql | sed -e 's/VALUES (\(.*\),.*/VALUES (\1, 1);/g' | sudo mysql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to do that with an update (that can be repeated)
_docs/guides/integrating-vms.md
Outdated
On the VM add ratings database to mysql. To make it easy to visually inspect the difference in the output of the bookinfo application, you can change the ratings that are generated by ratings service. | ||
```bash | ||
# Add ratings db to the mysql db | ||
curl -q https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/src/mysql/mysqldb-init.sql | sed -e 's/VALUES (\(.*\),.*/VALUES (\1, 1);/g' | sudo mysql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after the grant you need --password=password
(and don't need sudo); lets use
curl https://raw.githubusercontent.com/istio/istio/master/samples/bookinfo/src/mysql/mysqldb-init.sql | mysql -u root --password=password
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and add examples
$ mysql -u root --password=password test -e "select * from ratings;"
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 5 |
| 2 | 4 |
+----------+--------+
and
$ mysql -u root --password=password test -e "update ratings set rating=1 where reviewid=1;select * from ratings"
+----------+--------+
| ReviewID | Rating |
+----------+--------+
| 1 | 1 |
| 2 | 4 |
+----------+--------+
_docs/guides/integrating-vms.md
Outdated
## Registering the mysql service with the mesh | ||
On a host with access to `istioctl` commands, register the VM and mysql db service | ||
```bash | ||
istioctl -n default register mysqldb <ip-address-of-vm> 3306 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-n default
seems off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's show the output too
$ istioctl register mysqldb 10.150.0.5 3306 http:8080
I1014 22:54:12.176972 18162 register.go:44] Registering for service 'mysqldb' ip '10.150.0.5', ports list [{3306 mysql} {8080 http}]
I1014 22:54:12.177248 18162 register.go:49] 0 labels ([]) and 1 annotations ([alpha.istio.io/kubernetes-serviceaccounts=default])
W1014 22:54:13.194812 18162 register.go:123] Got 'services "mysqldb" not found' looking up svc 'mysqldb' in namespace 'default', attempting to create it
W1014 22:54:13.679181 18162 register.go:139] Got 'endpoints "mysqldb" not found' looking up endpoints for 'mysqldb' in namespace 'default', attempting to create them
I1014 22:54:13.954414 18162 register.go:180] No pre existing exact matching ports list found, created new subset {[{10.150.0.5 <nil> nil}] [] [{mysql 3306 } {http 8080 }]}
I1014 22:54:14.243637 18162 register.go:191] Successfully updated mysqldb, now with 2 endpoints
Jenkins job istio.github.io/presubmit passed |
Jenkins job istio.github.io/presubmit passed |
1 similar comment
Jenkins job istio.github.io/presubmit passed |
merging this as it's much better than previous content, we can refine later |
Add specific commands to support a vm running mysql db that has been setup with the ratings db.