Skip to content

Commit 1a9faf1

Browse files
authored
YARN-11313. [Federation] Add SQLServer Script and Supported DB Version in Federation.md. (#4927)
1 parent a708ff9 commit 1a9faf1

File tree

7 files changed

+229
-1
lines changed

7 files changed

+229
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to create a new Database in SQLServer for the Federation StateStore
20+
21+
IF DB_ID ( '[FederationStateStore]') IS NOT NULL
22+
DROP DATABASE [FederationStateStore];
23+
GO
24+
25+
CREATE database FederationStateStore;
26+
GO
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to create a new User in SQLServer for the Federation StateStore
20+
21+
USE [FederationStateStore]
22+
GO
23+
24+
CREATE LOGIN 'FederationUser' with password = 'FederationPassword', default_database=[FederationStateStore] ;
25+
GO
26+
27+
CREATE USER 'FederationUser' FOR LOGIN 'FederationUser' WITH default_schema=dbo;
28+
GO
29+
30+
EXEC sp_addrolemember 'db_owner', 'FederationUser';
31+
GO
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to drop the Federation StateStore in SQLServer
20+
21+
IF DB_ID ( '[FederationStateStore]') IS NOT NULL
22+
DROP DATABASE [FederationStateStore];
23+
GO
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to drop all the stored procedures for the Federation StateStore in SQLServer
20+
21+
USE [FederationStateStore]
22+
GO
23+
24+
DROP PROCEDURE IF EXISTS [sp_addApplicationHomeSubCluster];
25+
GO
26+
27+
DROP PROCEDURE IF EXISTS [sp_updateApplicationHomeSubCluster];
28+
GO
29+
30+
DROP PROCEDURE IF EXISTS [sp_getApplicationsHomeSubCluster];
31+
GO
32+
33+
DROP PROCEDURE IF EXISTS [sp_getApplicationHomeSubCluster];
34+
GO
35+
36+
DROP PROCEDURE IF EXISTS [sp_deleteApplicationHomeSubCluster];
37+
GO
38+
39+
DROP PROCEDURE IF EXISTS [sp_registerSubCluster];
40+
GO
41+
42+
DROP PROCEDURE IF EXISTS [sp_getSubClusters];
43+
GO
44+
45+
DROP PROCEDURE IF EXISTS [sp_getSubCluster];
46+
GO
47+
48+
DROP PROCEDURE IF EXISTS [sp_subClusterHeartbeat];
49+
GO
50+
51+
DROP PROCEDURE IF EXISTS [sp_deregisterSubCluster];
52+
GO
53+
54+
DROP PROCEDURE IF EXISTS [sp_setPolicyConfiguration];
55+
GO
56+
57+
DROP PROCEDURE IF EXISTS [sp_getPolicyConfiguration];
58+
GO
59+
60+
DROP PROCEDURE IF EXISTS [sp_getPoliciesConfigurations];
61+
GO
62+
63+
DROP PROCEDURE IF EXISTS [sp_addApplicationHomeSubCluster];
64+
GO
65+
66+
DROP PROCEDURE IF EXISTS [sp_updateReservationHomeSubCluster];
67+
GO
68+
69+
DROP PROCEDURE IF EXISTS [sp_getReservationsHomeSubCluster];
70+
GO
71+
72+
DROP PROCEDURE IF EXISTS [sp_getReservationHomeSubCluster];
73+
GO
74+
75+
DROP PROCEDURE IF EXISTS [sp_deleteReservationHomeSubCluster];
76+
GO
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to drop all the tables from the Federation StateStore in SQLServer
20+
21+
USE [FederationStateStore]
22+
GO
23+
24+
DROP TABLE [applicationsHomeSubCluster];
25+
GO
26+
27+
DROP TABLE [membership];
28+
GO
29+
30+
DROP TABLE [policies];
31+
GO
32+
33+
DROP TABLE [reservationsHomeSubCluster];
34+
GO
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
-- Script to drop the user from Federation StateStore in MySQL
20+
21+
DROP USER 'FederationUser';
22+
GO

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/Federation.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ SQL: one must setup the following parameters:
191191
|`yarn.federation.state-store.sql.username` | `<dbuser>` | For SQLFederationStateStore the username for the DB connection. |
192192
|`yarn.federation.state-store.sql.password` | `<dbpass>` | For SQLFederationStateStore the password for the DB connection. |
193193

194-
We provide scripts for MySQL and Microsoft SQL Server.
194+
We provide scripts for **MySQL** and **Microsoft SQL Server**.
195+
196+
> MySQL
195197
196198
For MySQL, one must download the latest jar version 5.x from [MVN Repository](https://mvnrepository.com/artifact/mysql/mysql-connector-java) and add it to the CLASSPATH.
197199
Then the DB schema is created by executing the following SQL scripts in the database:
@@ -205,9 +207,23 @@ In the same directory we provide scripts to drop the Stored Procedures, the Tabl
205207

206208
**Note:** the FederationStateStoreUser.sql defines a default user/password for the DB that you are **highly encouraged** to set this to a proper strong password.
207209

210+
**The versions supported by MySQL are MySQL 5.7 and above:**
211+
212+
1. MySQL 5.7
213+
2. MySQL 8.0
214+
215+
> Microsoft SQL Server
216+
208217
For SQL-Server, the process is similar, but the jdbc driver is already included.
209218
SQL-Server scripts are located in **sbin/FederationStateStore/SQLServer/**.
210219

220+
**The versions supported by SQL-Server are SQL Server 2008 R2 and above:**
221+
222+
1. SQL Server 2008 R2 Enterprise
223+
2. SQL Server 2012 Enterprise
224+
3. SQL Server 2016 Enterprise
225+
4. SQL Server 2017 Enterprise
226+
5. SQL Server 2019 Enterprise
211227

212228
####Optional:
213229

0 commit comments

Comments
 (0)