// Add steps as necessary for accessing the software, post-configuration, and testing. Don’t include full usage instructions for your software, but add links to your product documentation for that information.
//Should any sections not be applicable, remove them

=== Logging into an Apache RocketMQ NameServer or Broker server node

. Add a PEM key pair. For example:

[source,bash]
--
ssh-add -k /Users/username/tmp/rocketmqXXX.pem
--

[start=2]
. Sign into the bastion host.

[source,bash]
--
ssh -A  ec2-user@ecXXXXXXXX.cn-north-1.compute.amazonaws.com.cn
--

:xrefstyle: short
[start=3]
. Get the IP address from the Amazon EC2 console.
.. Open the https://console.aws.amazon.com/ec2/[Amazon EC2 console].
.. On the *Instances* screen, select the checkbox for the instance. Note the *Private IPs* in the *Description* tab, as shown in <<IPaddress>>.

[#IPaddress]
[link=images/NameServerIPAddress.png]
.EC2 instance private IP address
image::../images/NameServerIPAddress.png[NameServerAddress,width=75%,height=75%]

[start=4]
. From the bastion host, log into the node with the IP address. For example:

+
[source,bash]
----
(ec2-user@ip-10-0-136-135) $ ssh 10.0.6.235

Last login: Wed Jan  6 04:55:01 2021 from ip-10-0-136-135.cn-north-1.compute.internal

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|
https://aws.amazon.com/amazon-linux-2/

[ec2-user@ip-10-0-6-235 ~]$
----
+

[start=5]
. Once you are signed into the node, you can use https://rocketmq.apache.org/docs/cli-admin-tool/[Apache RocketMQ command-line tools] to query, manage, and diagnose issues.

=== Viewing the Apache RocketMQ web console in a browser

The default deployment installs the Apache RocketMQ web console on the name servers. However, as Apache name servers run in the private subnets, they cannot be accessed directly through a browser. To access port 8080 of the private IP address of the Apache name server, configure an SSH connection with the bastion host SSH tunnel. Then use the SSH tunnel to access the web console. 

[#step1]
. Establish a connection with the bastion host using SSH with the following command. Replace `_port number_`, `_key pair.pem_`, `_user name_`, and `_host name_` with your parameters.

+
`ssh -qTfnN -D _port number_ -i "_key pair.pem_" _user name_@_host name_`

+
For example:

+
`ssh -qTfnN -D 40011  -i "rocketMQ.pem" \ec2-user@ec2-54-223-36-247.cn-north-1.compute.amazonaws.com.cn`

. Set up a proxy manager in your browser. There are many proxy manager plug-ins available. These instructions use SwitchyOmega.
.. Install the SwitchyOmega plug-in.
** https://microsoftedge.microsoft.com/addons/detail/proxy-switchyomega/fdbloeknjpnloaggplaobopplkdhnikc?hl=en-US[Microsoft Edge]
** https://addons.mozilla.org/en-US/firefox/addon/switchyomega/?utm_source=addons.mozilla.org&utm_medium=referral&utm_content=search[Firefox]
** https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif?hl=en-US[Google Chrome]

+

.. Open the SwitchyOmega options page and select *New Profile* in the left sidebar.

+

:xrefstyle: short
[#addprofile]
[link=images/SwitchyOmega1.png]
.Add new SwitchyOmega profile
image::../images/switchyOmega1.png[SwitchyOmega,width=50%,height=50%]

+
[start=3]
.. Enter a name and select *Create*.

+

:xrefstyle: short
[#profilename]
[link=images/SwitchyOmega2.png]
.Profile name
image::../images/switchyOmega2.png[SwitchyOmega,width=50%,height=50%]

+
[start=4]
:xrefstyle: short
.. Enter the *Protocol*, *Server*, and *Port* for proxy server. The port should be the local port where you set up the SSH tunnel in link:#_step1[step 1].

+

[#proxyserverinfo]
[link=images/proxyserverinfo.png]
.Proxy servers
image::../images/proxyserverinfo.png[SwitchyOmega,width=50%,height=50%]

+
[start=5]
.. Select *Apply Changes*. 
.. Access SwitchyOmega through the extension icon of your browser. Select your created profile in the proxy list. The browser will send all traffic through the local port 40011 proxy to the bastion host.

+

:xrefstyle: short
[#proxylist]
[link=images/SwitchyOmega4.png]
.Proxy list
image::../images/switchyOmega4.png[SwitchyOmega,width=50%,height=50%]

+

[start=3]
. To view the Apache web console on a name server in your browser, navigate to `\http://10.0.xx.xx:8080`. Replace `xx.xx` with the private IP address of the name server. You can find the private IP address of a name server in the EC2 console.

+
:xrefstyle: short
[#ec2console]
[link=images/ec2.png]
.Private IP address of an Apache name server in the EC2 console
image::../images/ec2.png[ec2,width=90%,height=90%]

+
:xrefstyle: short
<<webconsole>> shows an example of an Apache RocketMQ cluster in the Apache web console.

+

[#webconsole]
[link=images/ec2.png]
.Apache web console
image::../images/rocketMQConsole.png[console,width=90%,height=90%]


=== Apache RocketMQ resources

==== NameServer nodes

* Apache RocketMQ installation guide: `/home/ec2-user/rocketmq-deploy`
* Apache RocketMQ installation directory: `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.7.1-bin-release` or `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.8.0-bin-release` or `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.9.2`
* Deployment script installation log used to troubleshoot error messages: `/home/ec2-user/rocketmq-deploy/install.log`
* Apache RocketMQ web console: `/home/ec2-user/rocketmq-deploy/rocketmq-console-ng-1.0.0.jar`

==== Broker server nodes

* Apache RocketMQ installation guide: `/home/ec2-user/rocketmq-deploy`
* Apache RocketMQ installation directory: `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.7.1-bin-release` or `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.8.0-bin-release` or `/home/ec2-user/rocketmq-deploy/rocketmq-all-4.9.2`
* Deployment script installation logs: `/home/ec2-user/rocketmq-deploy/install.log`
* Configuration file: `/home/ec2-user/rocketmq-deploy/rocketMQ-config/`
* Apache RocketMQ local file storage: `/home/ec2-user/rocketmq-deploy/rmqstore`



== Best practices for using {partner-product-short-name} on AWS
// Provide post-deployment best practices for using the technology on AWS, including considerations such as migrating data, backups, ensuring high performance, high availability, etc. Link to software documentation for detailed information.

* https://rocketmq.apache.org/docs/best-practice-namesvr/[Best Practice for NameServer]
* https://rocketmq.apache.org/docs/best-practice-broker/[Best Practice for Broker]
* https://rocketmq.apache.org/docs/best-practice-producer/[Best Practice for Producer]
* https://rocketmq.apache.org/docs/best-practice-consumer/[Best Practice for Consumer]



