bc26465fe6f854030d9f3c01796324929522c300
[music.git] / docs / multi.rst
1 ===========================
2 Multi-site or Local Cluster
3 ===========================
4 Follow the instructions for local MUSIC installation on all the machines/VMs/hosts (referred to as a node) on which you want MUSIC installed. However, Cassandra and Zookeeper needs to be configured to run as multi-node installations (instructions below) before running them.
5
6 Cassandra:
7 ----------
8 In the cassandra.yaml file which is present in the cassa_install/conf directory in each node, set the following parameters:
9 cassandra.yaml::
10
11     cluster_name: ‘name of cluster’
12     #...
13     num_tokens: 256
14     #...
15     seed_provider:
16      - class_name: org.apache.cassandra.locator.SimpleSeedProvider
17      parameters:
18       - seeds:  "<public ip of first seed>, <public ip of second seed>, etc"
19     #...
20     listen_address: private ip of VM
21     #...
22     broadcast_address: public ip of VM
23     #...
24     endpoint_snitch: GossipingPropertyFileSnitch
25     #...
26     rpc_address: <private ip>
27     #...
28     phi_convict_threshold: 12
29
30 - In the cassandra-rackdc.properties file, assign data center and rack names as needed if required ( This is for multi data center install).
31 - Once this is done on all three nodes, you can run cassandra on each of the nodes through the cassandra bin folder with this command::     
32
33     ./cassandra
34
35 - In the cassandra bin folder, if you run the following it will tell you the state of the cluster::       
36
37     ./nodetool status
38
39 - To access cassandra, one any of the nodes you can run the following and then perform CQL queries.::
40
41     ./cqlsh <private ip>
42
43 Extra Cassandra information for Authentication:
44 -----------------------------------------------
45 To create first user in Cassandra
46
47 1. Edit conf/Cassandra.yaml file::
48
49     authenticator: PasswordAuthenticator
50     authorizer: CassandraAuthorizer
51
52
53 2. Restart Cassandra
54 3. Login to cqlsh with default credentials::
55
56     cqlsh -u cassandra -p cassandra
57
58 4. To change default user create new user with the following command.::
59
60     CREATE USER new_user WITH PASSWORD ‘new_password’ SUPERUSER;
61
62 5. Change password for default user ‘Cassandra’ so that no one will be able to login::
63    
64     ALTER USER cassandra WITH PASSWORD ‘SomeLongRandomStringNoonewillthinkof’;
65
66 6. Provide the new user credentials to Music. Update music.properties file and uncomment or add the following::
67
68     cassandra.user=<new_user>
69     cassandra.password=<new_password>
70
71 To access keyspace through cqlsh, login with credentials that are passed to MUSIC while creating the keyspace.
72
73
74
75 Zookeeper:
76 ----------
77 Once zookeeper has been installed on all the nodes, modify the  **zk_install_location/conf/zoo.cfg** on all the nodes with the following lines:
78
79 ::
80
81     tickTime=2000
82     dataDir=/opt/app/music/var/zookeeper
83     clientPort=2181
84     initLimit=5
85     syncLimit=2
86     quorumListenOnAllIPs=true
87     server.1=public IP of node 1:2888:3888
88     server.2=public IP of node 2:2888:3888
89     server.3=public IP of node 3:2888:3888
90
91 Create the directory /var/zookeeper in all the machines and within that create a file called myid that contains the id of the machine. The machine running node.i will contain just the number i in the file myid.
92
93 Start each of the nodes one by one from the zk_install_location/bin folder using the command:
94
95
96
97  ./zkServer.sh start
98
99 On each node check the file zookeeper.out in the  zk_install_location/ bin to make sure all the machines are talking to each other and there are no errors. Note that while the machines are yet to come up there maybe error messages saying that connection has not yet been established. Clearly, this is ok.
100
101
102 If there are no errors, then from zk_install_location/bin simply run the following to get command line access to zookeeper.   ./zkCli.sh
103
104
105 Run these commands on different machines to make sure the zk nodes are syncing.
106
107 ::
108
109     [zkshell] ls /
110     [zookeeper]
111
112 Next, create a new znode by running
113
114 ::
115
116     create /zk_test my_data.
117
118 This creates a new znode and associates the string "my_data" with the node. You should see:
119
120 ::
121
122     [zkshell] create /zk_test my_data
123     Created /zk_test
124
125 Issue another ls / command to see what the directory looks like:
126
127 ::
128
129     [zkshell] ls /
130     [zookeeper, zk_test]
131
132 MUSIC
133 Create a music.properties file and place it in /opt/app/music/etc at each node. Here is a sample of the file: 
134 cassandra.yaml::
135
136     my.id=0
137     all.ids=0
138     my.public.ip=localhost
139     all.public.ips=localhost
140     #######################################
141     # Optional current values are defaults
142     #######################################
143     # If using docker this would point to the specific docker name.
144     #zookeeper.host=localhost
145     #cassandra.host=localhost
146     #music.ip=localhost
147     #debug=true
148     #music.rest.ip=localhost
149     #lock.lease.period=6000
150     # Cassandra Login - Do not user cassandra/cassandra
151     cassandra.user=cassandra1
152     cassandra.password=cassandra1
153     # AAF Endpoint
154     #aaf.endpoint.url=<aaf url>
155
156 - Build the MUSIC.war (see `Build Music`_) and place it within the webapps folder of the tomcat installation.
157 - Start tomcat and you should now have MUSIC running.
158
159 For Logging create a dir /opt/app/music/logs. When MUSIC/Tomcat starts a MUSIC dir with various logs will be created.
160
161 Build Music
162 ^^^^^^^^^^^
163 Documentation will be updated to show that. Code can be downloaded from Music Gerrit. 
164 To build you will need to ensure you update your settings with the ONAP settings.xml 
165 (Workspace and Development Tools)
166
167 Once you have done that run the following:
168
169 ::
170
171     # If you installed settings.xml in your ./m2 folder
172     mvn clean package
173     # If you placed the settings.xml elsewhere:
174     mvn clean package -s /path/to/settings.xml
175
176 After it is built you will find the MUSIC.war in the ./target folder. 
177
178 There is a folder called postman that contains a postman collection for testing with postman. 
179
180 Continue with `Authentication <./automation.rst>`_
181