NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERSIN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
Inorder to log into MariaDB to secure it, we'll need the current passwordfor the root user. If you've just installed MariaDB, and youhaven't set the root password yet, the password will be blank, soyou should just press enter here.
Entercurrent password for root (enter for none): OK,successfully used password, moving on...
Settingthe root password ensures that nobody can log into the MariaDB rootuser without the proper authorisation.
Bydefault, a MariaDB installation has an anonymous user, allowing anyone tolog into MariaDB without having to have a user account created for them.This is intended only for testing, and to make the installation goa bit smoother. You should remove them before moving into a productionenvironment.
Removeanonymous users? [Y/n] ...Success!
Normally,root should only be allowed to connect from 'localhost'. This ensuresthat someone cannot guess at the root password from the network.
Disallowroot login remotely? [Y/n] n ...skipping.
Bydefault, MariaDB comes with a database named 'test' that anyone can access.This is also intended only for testing, and should be removed beforemoving into a production environment.
Removetest database and access to it? [Y/n] -Dropping test database... ...Success! -Removing privileges on test database... ...Success!
Reloadingthe privilege tables will ensure that all changes made so far willtake effect immediately.
Reloadprivilege tables now? [Y/n] ...Success!
Cleaningup...
Alldone! If you've completed all of the above steps, your MariaDB installationshould now be secure.
Thanksfor using MariaDB!
5.3.1.创建数据库
1 2 3 4 5 6 7 8 9
mysql -uroot -p # 创建amabri数据库 create database ambari; #授权 grant all on ambari.* to ambari@'%' identified by 'bigdata'; grant all on ambari.* to ambari@localhost identified by 'bigdata'; # 使用ambari-server提供的sql脚本创建相关的表 use ambari; source /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql
[root@hdp-1~]# ambari-server setup Usingpython /usr/bin/python Setupambari-server CheckingSELinux... SELinuxstatus is 'enabled' SELinuxmode is 'permissive' WARNING: SELinux is set to 'permissive' mode and temporarily disabled. OKto continue [y/n] (y)? y Customizeuser account for ambari-server daemon [y/n] (n)? y Enteruser account for ambari-server daemon (root): Adjustingambari-server permissions and ownership... Checkingfirewall status... CheckingJDK... [1]Oracle JDK 1.8 + Java Cryptography Extension (JCE) Policy Files 8 [2]Custom JDK ============================================================================== Enterchoice (1): 2 WARNING: JDK must be installed on all hosts and JAVA_HOME must be valid on all hosts. WARNING: JCE Policy files are required for configuring Kerberos security. If you plan to use Kerberos,please make sure JCE Unlimited Strength Jurisdiction Policy Files are valid on all hosts. Pathto JAVA_HOME: /opt/jdk1.8.0_171/ ValidatingJDK on Ambari Server...done. CheckJDK version for Ambari Server... JDKversion found: 8 MinimumJDK version is 8 for Ambari. Skipping to setup different JDK for Ambari Server. CheckingGPL software agreement... GPLLicense for LZO: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html EnableAmbari Server to download and install GPL Licensed LZO packages [y/n] (n)? Completingsetup... Configuringdatabase... Enteradvanced database configuration [y/n] (n)? y Configuringdatabase... ============================================================================== Chooseone of the following options: [1]- PostgreSQL (Embedded) [2]- Oracle [3]- MySQL / MariaDB [4]- PostgreSQL [5]- Microsoft SQL Server (Tech Preview) [6]- SQL Anywhere [7]- BDB ============================================================================== Enterchoice (1): 3 Hostname(localhost): Port(3306): Databasename (ambari): Username(ambari): EnterDatabase Password (bigdata): Configuringambari database... Shouldambari use existing default jdbc /usr/share/java/mysql-connector-java.jar [y/n] (y)? Configuringremote database connection properties... WARNING: Before starting Ambari Server, you must run the following DDL against the database to create the schema: /var/lib/ambari-server/resources/Ambari-DDL-MySQL-CREATE.sql Proceedwith configuring remote database connection properties [y/n] (y)? Extractingsystem views... ambari-admin-2.7.0.0.897.jar .... Ambarirepo file doesn't contain latest json url, skipping repoinfos modification Adjustingambari-server permissions and ownership... AmbariServer 'setup' completed successfully.
create database hive; create user "hive"@"%" identified by "hive"; grant all privileges on hive.* to 'hive'@'%' identified by 'hive'; flush privileges;