Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Garbage Priority Garbage Collector

Garbage Priority Garbage Collector (G1 GC) Use notes

G1 GC is a new garbage collection strategy, starting with JDK7, mainly for server-side JVM, and large memory applications, the goal is to achieve similar high-throughput CMS. G1 is still the idea of ??sub-management, the main use of the idea of ??block management, through the memory is divided into no more than 2048 blocks, each size between 1M-32M, Eden, Survivor space and old generation are one Series of discontinuous logical regions.

Here do not talk about the concrete realization of G1 ideas, only record how to configure and use.

Start the G1 GC

-XX: + UseG1GC

Several parameters and default values

  • -XX:MaxGCPauseMillis=200 Maximum pause time, which is a target value, JVM will try to close to this target, the default value of 200.
  • -XX:G1HeapRegionSize=n G1 area block size, 1M-32M, must be a power of 2, G1 will be based on the size of the block plan is not more than 2048 blocks.
  • -XX:G1NewSizePercent=5 Young generation in the heap in the smallest percentage, the default value is 5%
  • -XX:G1MaxNewSizePercent=60 The maximum percentage of young generations in the heap, the default is 60%
  • -XX:ParallelGCThreads=nSets the value of the STW worker thread. Set the value of n to the number of logical processors. The value of n is the same as the number of logical processors, up to 8. If there are more than eight logical processors, set the value of n to about 5/8 of the number of logical processors. This applies to most cases unless it is a larger SPARC system, where the value of n can be about 5/16 of the number of logical processors.
  • -XX:ConcGCThreads=nSets the number of threads that are marked in parallel. Set n to 1/4 of the amount of parallel garbage collection threads (ParallelGCThreads).
  • -XX:InitiatingHeapOccupancyPercent=45 Mark the garbage threshold, the default 45%
  • -XX:G1ReservePercent=10Set the percentage of reserved memory as free space to reduce the risk of target space spillovers. The default value is 10%.

Suggest

  • Avoid using the -Xmn option or other related options such as -XX: NewRatio to explicitly set the young generation size. Fixed young generation size will cover the pause time target.
  • Pause time goals are not too small, because pause time and throughput are a contradictory indicator.

example

This is a simple configuration of tomcat startup

Export CATALINA_OPTS = “$ CATALINA_OPTS -Xms10g”
Export CATALINA_OPTS = “$ CATALINA_OPTS -Xmx10g”
Export CATALINA_OPTS = “$ CATALINA_OPTS -Xss512k”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: + DisableExplicitGC”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: + HeapDumpOnOutOfMemoryError”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: + UnlockExperimentalVMOptions”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: + UseG1GC”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: MaxGCPauseMillis = 200”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: G1NewSizePercent = 40”
Export CATALINA_OPTS = “$ CATALINA_OPTS -XX: G1MaxNewSizePercent = 80”

G1NewSizePercentAnd G1MaxNewSizePercentexperimental properties, so please through the -XX:+UnlockExperimentalVMOptionsopen test option.

Done.

tomcat monitor script

#!/bin/bash
echo $(date ‘+%Y-%m-%d %H:%M:%S’)
whoami
JAVA_HOME=/opt/java/jdk1.8.0_40
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
port=8086
sn=“tomcat-image-$port
th=“/home/dev/tomcat/$sn
url=“http://you-app-server/”
tomcat=`ps -ef | grep java | grep $sn | grep $port | wc -l`
if [ $tomcat -eq 0 ]
then
echo $sn stoped.
echo starting $sn ……
$th/bin/startup.sh
fi
if [ $tomcat -ge 1 ]
then
tpid=`ps -ef | grep java | grep $sn | grep $port | awk ‘{print $2}’`
echo $sn is running, pid = $tpid
httpStatus=`curl -I $url 2>/dev/null | grep HTTP | awk ‘{print $2}’`
echo $httpStatus
if [[ -z $httpStatus || $httpStatus -ge 500 ]]
then
echo killing $sn ……
kill -9 $tpid
echo starting $sn ……
$th/bin/startup.sh
fi
fi
crontab -e
*/5 * * * * /tomcat-inspector/image.sh >> /logs/image.log 2>&1

How To Configure a Redis Cluster on CentOS 7

yum install gcc make
cd ~
mkdir init
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
tar -zxvf redis-3.2.3.tar.gz 
cd redis-3.2.3
make 
make install

#cd utils
#./install_server.sh

cd src/
cp redis-server redis-cli /usr/local/bin
cp redis-sentinel redis-benchmark redis-check-aof redis-check-dump /usr/local/bin

mkdir /etc/redis
mkdir -p /var/lib/redis/6379

Set the vm.overcommit_memory to 1, which means always, this will avoid data to be truncated, take a look here for more.

sysctl -w vm.overcommit_memory=1

Change the maximum of backlog connections some value higher than the value on tcp-backlog option of redis.conf, which defaults to 511. You can find more on sysctl based ip networking “tunning” on kernel.org website.

sysctl -w net.core.somaxconn=512

Disable transparent huge pages support, that is known to cause latency and memory access issues with Redis.

echo never > /sys/kernel/mm/transparent_hugepage/enabled

Redis.conf is the Redis configuration file, however you will see the file named as 6379.conf here, where the number is the same as the network port is listening to. This name is recommended if you are going to run more than one Redis instance.

cp redis.conf /etc/redis/6379.conf
vim /etc/redis/6379.conf

daemonize yes #note
pidfile /var/run/redis_6379.pid
port 6379
loglevel notice
logfile /var/log/redis_6379.log
dir /var/lib/redis/6379

Starting at boot

cp utils/redis_init_script /etc/init.d/redis_6379
vim /etc/systemd/system/redis_6379.service

[Unit]
Description=Redis on port 6379

[Service]
Type=forking
ExecStart=/etc/init.d/redis_6379 start
ExecStop=/etc/init.d/redis_6379 stop

[Install]
WantedBy=multi-user.target

vim /etc/sysctl.conf

vm.overcommit_memory = 1
net.core.somaxconn=512

For the transparent huge pages support there is no sysctl directive, so you can put the command at the end of /etc/rc.local

echo never > /sys/kernel/mm/transparent_hugepage/enabled

 

Configure Redis Master

vi /etc/redis.conf

daemonize yes #note
tcp-keepalive 60
#bind 127.0.0.1
requirepass your_redis_master_password
maxmemory-policy noeviction
appendonly yes
appendfilename "appendonly.aof"

restart if makeinstall
redis-server /etc/redis/6379.conf

Configure Redis Slave

daemonize yes #note
#bind 127.0.0.1
requirepass your_redis_slave_password
slaveof your_redis_master_ip 6379
masterauth your_redis_master_password

Realize MySQL database automatic backup under Linux

1.Linux under MySQL to create a user backup role, and granted the role of SELECT, RELOAD, SHOW DATABASES, LOCK TABLES and other permissions.

 

mysql> create user 'backuper'@'localhost' identified by '********';
Query OK, 0 rows affected (0.00 sec)

mysql> grant SELECT, RELOAD, SHOW DATABASES, LOCK TABLES on *.* to backuper@localhost;
Query OK, 0 rows affected (0.00 sec)

2. In the system to find a relatively large hard disk to create a backup directory, and create a shell script

vim backup_mohan_db.sh

#!/bin/bash
mysqldump -ubackuper -p******** qianyu_veeker_db > /home/mysql/backup/mohan_db_$(date +%Y%m%d_%H%M%S)

3. To add the scheduled task, you need to install the crontab 
vixie-cron package is the main program for cron; the 
crontabs package is the program used to install, uninstall, or list the tables used to drive the cron daemon.

[root@~]# yum -y install vixie-cron
[root@~]# yum -y install crontabs

4. Set boot to start

[root@ ~]# chkconfig --level 345 crond on

[root@linuxidc etc]# vim crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
#|  .------------- hour (0 - 23)
#|  |  .---------- day of month (1 - 31)
#|  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
#|  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
#|  |  |  |  |
#*  *  *  *  * user-name command to be executed
0 0 * * * /home/mysql/backup/mohan_db.sh

MySQL 5.7 forget the root password

surroundings

CentOS 6.6 X86_64

background

Forget how to do root, forget to initialize MySQL generated when the random password how to do, or simply did not register that random password, do not tell me to clear all the data under data, reinitialize, of course, you have to be so wayward can also be.
Do not pull, the following is the title.

reference

Http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

operating

There are several ways in the official document, I read the next, you remember the following I said a bar, the other you try it, so good to make me no matter

Use –skip-grant-tables to start mysql server
bin / mysqld_safe –user = mysql01 –skip-grant-tables – skip-networking &

Two options are meaning –
skip-grant-tables skip authorization –
skip-networking does not allow remote network connection

Skip-networking can not, to prevent other users to connect the remote operation of the database, do not look at the actual situation. Just learn an option.

Client login
bin / mysql -uroot -p
update mysql.user set authentication_string = password (‘root’), password_expired = ‘N’ where user = ‘root’;
flush privileges;

Change the password if you still remember ALTER USER ‘root’ @ ‘localhost’ IDENTIFIED BY ‘root’;
it is best not to use, it may prompt anonymous users do not allow to change the password and the like.

Description

All relevant directories, links, parameters, etc., please adjust according to the actual situation.

MySQL 5.7 multi-instance installation deployment instance

1. Background
MySQL database centralized operation and maintenance, through a server, the deployment of running multiple MySQL service process, through a different socket to monitor different service ports to provide their services. Each instance is independent of each other, each instance of the datadir, port, socket, pid are different.

2. Multi-instance features
* Effective use of server resources, when a single server resources are left, you can make full use of the remaining resources to provide more services.
* Resources to each other to seize the problem, when a service instance service is high or open slow query, it will consume more memory, CPU, disk IO resources, resulting in other instances of the server to provide services to reduce the quality.

 

[root@MySQL ~]# cat /etc/RedHat-release
CentOS release 6.9 (Final)

[root@MySQL ~]# uname -r
2.6.32-696.3.2.el6.x86_64

[root@MySQL ~]# getenforce
Disabled

[root@MySQL ~]# tar zxvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz -C /usr/local/

[root@MySQL ~]# ln -s /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql

[root@MySQL ~]# useradd -r -s /sbin/nologin mysql

[root@MySQL ~]# mkdir -v /usr/local/mysql/mysql-files
mkdir: created directory `/usr/local/mysql/mysql-files’

[root@MySQL ~]# mkdir -vp /data/mysql_data{1..4}
mkdir: created directory `/data’
mkdir: created directory `/data/mysql_data1′
mkdir: created directory `/data/mysql_data2′
mkdir: created directory `/data/mysql_data3′
mkdir: created directory `/data/mysql_data4′

1 [root@MySQL ~]# chown root.mysql -R /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64

[root@MySQL ~]# chown mysql.mysql -R /usr/local/mysql/mysql-files /data/mysql_data{1..4}

/etc/my.cnf
[mysqld_multi]
mysqld    = /usr/local/mysql/bin/mysqld
mysqladmin = /usr/local/mysql/bin/mysqladmin
log        = /tmp/mysql_multi.log

 

[mysqld1]

datadir = /data/mysql_data1

socket = /tmp/mysql.sock1

port = 3306

user = mysql

performance_schema = off

innodb_buffer_pool_size = 32M

bind_address = 0.0.0.0

skip-name-resolve = 0

[mysqld2]
datadir = /data/mysql_data2
socket = /tmp/mysql.sock2
port = 3307
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0

[mysqld3]
datadir = /data/mysql_data3
socket = /tmp/mysql.sock3
port = 3308
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0

[mysqld4]
datadir = /data/mysql_data4
socket = /tmp/mysql.sock4
port = 3309
user = mysql
performance_schema = off
innodb_buffer_pool_size = 32M
bind_address = 0.0.0.0
skip-name-resolve = 0

 

 

[root@MySQL ~]# /usr/local/mysql/bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql_data1
[root@MySQL ~]# /usr/local/mysql/bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql_data2
[root@MySQL ~]# /usr/local/mysql/bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql_data3
[root@MySQL ~]# /usr/local/mysql/bin/mysqld –initialize –user=mysql –basedir=/usr/local/mysql –datadir=/data/mysql_data4

 

[root@MySQL ~]# cp /usr/local/mysql/support-files/mysqld_multi.server /etc/init.d/mysqld_multi

 

[root@MySQL ~]# chmod +x /etc/init.d/mysqld_multi

 

[root@MySQL ~]# chkconfig –add mysqld_multi

 

[root@MySQL ~]# /etc/init.d/mysqld_multi report
Reporting MySQL servers
MySQL server from group: mysqld1 is not running
MySQL server from group: mysqld2 is not running
MySQL server from group: mysqld3 is not running
MySQL server from group: mysqld4 is not running

 

[root@MySQL ~]# /etc/init.d/mysqld_multi start

 

Reporting MySQL servers
MySQL server from group: mysqld1 is running
MySQL server from group: mysqld2 is running
MySQL server from group: mysqld3 is running
MySQL server from group: mysqld4 is running

 

[root@MySQL ~]# netstat -lntp | grep mysqld
tcp        0      0 0.0.0.0:3306        0.0.0.0:*                LISTEN      2673/mysqld
tcp        0      0 0.0.0.0:3307        0.0.0.0:*                LISTEN      2676/mysqld
tcp        0      0 0.0.0.0:3308        0.0.0.0:*                LISTEN      2679/mysqld
tcp        0      0 0.0.0.0:3309        0.0.0.0:*                LISTEN      2682/mysqld

 

[root@MySQL ~]# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock1  -p’z+Ilo*>s:3kw’
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.18

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> set password = ‘123456’;
Query OK, 0 rows affected (0.00 sec)

[root@MySQL ~]# /usr/local/mysql/bin/mysql -S /tmp/mysql.sock2  -p’b*AHUrTgu1rl’
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.7.18

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> set password = ‘123456’;
Query OK, 0 rows affected (0.00 sec)

CentOS 7 rpm installed under the MySQL 5.6.36

CentOS 7 under the local installation of MySQL 5.7, but the springboot integration jpa will appear hibernateException, do not know why, for a MySQL5.6 version of MySQL, source installation, cmake has been through, and later into rpm installation.

Local installation of mysql5.7, but the integration of springboot jpa will appear hibernateException, do not know why, for a mysql5.6 version of the mysql, source installation, cmake has been through, and later changed to rpm installation

1, get mysql5.6

Ftp://ftp.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.6/

download: 

Where el6 identifies centos 6, el7 identifies centos 7

2, installation

Rpm -ivh MySQL- *

3, start

Systemctl start mysql

4, view the initial password

Cat /root/.mysql_secret

5, change the password

Mysql -uroot -pKAKt5JmEjm6B8omV
SET PASSWORD = PASSWORD('root');

6, remote login settings

Mysql> user mysql;
Mysql > select host, user, password from user;
Mysql > update user set password = password ( ' root ' ) where user = ' root ' ;
MySQL > Update the User the SET Host = ' % '  the WHERE the User = ' root ' and Host = ' localhost ' ; 

authorized 
GRANT  ALL  PRIVILEGES  . ON * *  the TO  'root' @ '%' IDENTIFIED  BY  'Here is your password'  the WITH  GRANT

7, set the boot start

[Root @ localhost ~ ] # chkconfig mysql on
[Root @ localhost ~] # chkconfig --list | grep mysql

8, MySQL default installation location

/ Var / lib / mysql /                # database directory
 / usr / share / mysql # configuration file directory
 / usr / bin # related command directory
 /etc/init.d/mysql # start script

9, modify the default character set and so on

Vim /etc/my.cnf

[client] 
password        = root
port            = 3306 
default-character-set=utf8 
[mysqld] 
port            = 3306 
character_set_server=utf8 
character_set_client=utf8 
collation-server=utf8_general_ci 
lower_case_table_names=1 
max_connections=1000 
[mysql] 
default-character-set = utf8 

10, view the character set

Show variables like ' % collation% ' ;  
Show variables like ' % char% ' ;

MySQL index conditions push a simple test

Since MySQL 5.6, there have been some improvements in the index, such as the index condition pushdown (ICP), strictly speaking, the optimizer level improvement.

If it is simple to understand, that is, the optimizer will try to index the treatment from the Server layer to the storage engine layer. As an example, there is a table containing the combined index idx_cols containing (c1, c2, …, cn) n columns, if there is a range scan on the where1 condition, then the remaining c2, …, cn this n-1 On the index can not be used to extract and filter data, and ICP is to optimize this thing.

We are in the MySQL 5.6 environment to a simple test.

We create the table emp, which contains a primary key, a combined index to illustrate.

Create Table EMP (
EMPNO smallint The (. 5) unsigned Not null AUTO_INCREMENT,
ename VARCHAR (30) Not null,
DEPTNO smallint The (. 5) unsigned Not null,
Job VARCHAR (30) Not null,
Primary Key (EMPNO),
Key idx_emp_info (DEPTNO, Ename)
) engine = InnoDB charset = utf8;

Of course, I also randomly inserted a few data, meaning that

Insert the emp values ??(1, ‘zhangsan’, 1, ‘CEO’), (2, ‘lisi’, 2, ‘CFO’), (3, ‘wangwu’, 3, ‘CTO’), (4, Jeanron100 ‘, 3,’ Enginer ‘);

ICP control in the database parameters have an optimizer parameter optimizer_switch to unified management, I think this is the MySQL optimizer from our closest time. You can use the following way to view.

Show variables like ‘optimizer_switch’;

Of course, in the previous version of 5.6, you can not see the index condition pushdown this kind of words. The results in the 5.6 version are as follows:

In the same way as in the case of the following event: index_merge_switch = on, mrr = on, mrr_cost_based = on, block_nested_loop = on, batched_key_access = off, materialization = On, semijoin = on, loosescan = on, firstmatch = on, subquery_materialization_cost_based_ed, use_index_extensions = on Here we use two statements to compare the description, through the implementation of the plan to contrast.

Set optimizer_switch = “index_condition_pushdown = off”

> Explain select * from emp where deptno between 1 and 100 and ename = ‘jeanron100’;
+ —- + ————- + ——- + — — + ————— + —— + ——— + —— + —— +
| __- + | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+ —- + ——– —– + ——- + —— + ————— + —— + —— —
| + + + + + _— + | 1 | SIMPLE | emp | ALL | idx_emp_info | NULL | NULL | NULL | 4 | Using where |
+ —- + ————- + ——- + —— + ———– —- + —— + ——— + —— + —— + ————- +

And if it is turned on, see if ICP is enabled.
Set optimizer_switch = “index_condition_pushdown = on”;> explain select * from emp where deptno between 10 and 3000 and ename = ‘jeanron100’;

> Explain select * from emp where deptno between 1 and 300 and ename = ‘jeanron100’;
+ —- + ————- + ——- + — — + ————— + —— + ——— + —— + —— +
| __- + | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+ —- + ——– —– + ——- + —— + ————— + —— + —— —
| + + + + + _— + | 1 | SIMPLE | emp | ALL | idx_emp_info | NULL | NULL | NULL | 4 | Using where |
+ —- + ————- + ——- + —— + ———– —- + —— + ——— + —— + —— + ————- +
1 row in set (0.00 sec) This place is worth considering.

Oracle backup script

Oracle backup script

#!/bin/bash
#oracle_backup.sh version1.0 chmod 700
#00 00 * * * /usr/local/scripts/oracle_backup.sh
#chmod 700 /usr/local/scripts/oracle_backup.sh
#You must first import the environment variables in the Oracle user’s bash_profile file
#Must be used to define the DBA account first dpdata1 path and authorized directory to read and write, modify the dpdata1 group

export ORACLE_BASE=/usr/local/u01/oracle
export ORACLE_HOME=/usr/local/u01/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=oracle11
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
datetime=$(date +”%Y%m%d”)
dpdata1_dir=”/data/backup/oracle_backup”
oracle_u01=”u01″
oracle_u02=”u02″
oracle_password1=”u01_password”
oracle_password2=”u02_password”

expdp ${oracle_u01}/${oracle_password1} directory=dpdata1 dumpfile=${oracle_u01}_${datetime} logfile=${oracle_u01}_${datetime}.log

if [ $? -ne 0 ];then
echo “$(date +”%Y-%m-%d_%H:%M:%S”)oracle_${oracle_u01}_backup_file!” > ${dpdata1_dir}/${datetime}_err.log
fi

expdp ${oracle_u02}/${oracle_password2} directory=dpdata1 dumpfile=${oracle_u02}_${datetime} logfile=${oracle_u02}_${datetime}.log

if [ $? -ne 0 ];then
echo “$(date +”%Y-%m-%d_%H:%M:%S”)oracle_${oracle_u02}_backup_file!” >> ${dpdata1_dir}/${datetime}_err.log
fi

/usr/bin/bzip2 -z ${dpdata1_dir}/*${datetime}*
find $dpdata1_dir -type f -ctime +30 -name “*.bz2” -exec rm -vf {} \;

CentOS 7.2 Installation Deployment OpenStack Tutorial

CentOS 7.2 Installation Deployment OpenStack Tutorial

Environmental preparation

 

Share CentOS 7.2 installation deployment OpenStack tutorial, we want to help.

1, the system environment

# Uname -r

3.10.0-327.el7.x86_64

# Cat / etc / RedHat -release

CentOS Linux release 7.2.1511 (Core)

2, the server deployment

IP

CPU name

Character

Configuration

192.168.56.108

Controller

Control node

M: 4G; C: 2C; 50G

192.168.56.109

Compute

Calculate nodes

M: 2G; C: 2C; 50G

3, the basic environment to prepare

3.1, configure hosts

# Cat / etc / hosts

192.168.56.108 controller

192.168.56.109 compute

3.2, configure the time synchronization

[Root @ controller ~] # yum install -y ntp

[Root @ controller ~] # vim /etc/ntp.conf

15 restrict -6 :: 1

16 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

27 restrict 0.centos.pool.ntp.org nomodify notrap noquery

28 restrict 1.centos.pool.ntp.org nomodify notrap noquery

29 restrict 2.centos.pool.ntp.org nomodify notrap noquery

30 restrict 3.centos.pool.ntp.org nomodify notrap noquery

31 server 127.127.1.0

32 fudge 127.127.1.0 stratum 10

[Root @ controller ~] # systemctl enable ntpd

[Root @ controller ~] # systemctl start ntpd

Configure timing tasks on the control node and compute nodes

[Root @ compute ~] # crontab -l * / 5 * * * * / usr / sbin / ntpdate 192.168.56.108> / dev / null 2> & 1

3.3, turn off the firewall

# Systemctl stop firewalld

3.4, close selinux

# SELINUX = disabled / etc / selinux / config // need to reboot

3.5, install the basic package

[Root @ controller ~] # yum install -yhttp: // dl. Fedora project.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm

[Root @ controller ~] # yum install -y centos-release-openstack-liberty

[Root @ controller ~] # yum install -y python-openstackclient

3.6, install mysql

[Root @ controller ~] # yum install -y mariadb mariadb-server mysql-python

[Root @ controller ~] # vim /etc/my.cnf

Add the following lines in the mysqld module:

Default-storage-engine = innodb

Innodb_file_per_table

Collation-server = utf8_general_ci

Init-connect = ‘SET NAMES utf8’

Character-set-server = utf8

[Root @ controller ~] # systemctl enable mariadb.service

[Root @ controller ~] # systemctl start mariadb.service

[Root @ controller ~] # mysql_secure_installation

3.7, install rabbitmq

[Root @ controller ~] # yum install-y rabbitmq-server

[Root @ controller ~] # systemctl enable rabbitmq-server.service

[Root @ controller ~] # systemctl start rabbitmq-server.service

[Root @ controller ~] # rabbitmqctl add_user openstack openstack

Creating user “openstack” …

… done.

[Root @ controller ~] # rabbitmqctl set_permissions openstack ‘. *’ ‘. *’ ‘. *’

Setting permissions for user “openstack” in vhost “/” …

… done.

[Root @ controller ~] # rabbitmqctl set_user_tags openstack administrator

[Root @ controller ~] # rabbitmq-plugins enable rabbitmq_management

[Root @ controller ~] # systemctl restart rabbitmq-server.service

In the browser, enter http://192.168.56.108:15672, the default account and password for the guest

Login will be created before the openstack users to join admin, the results are as follows:

 

[root@controller ~]# mysql -u root -p
[root@controller ~]# CREATE DATABASE keystone;
[root@controller ~]# GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone’@’localhost’ IDENTIFIED BY ‘PWS’;
[root@controller ~]# GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone’@’%’ IDENTIFIED BY ‘PWS’;
[root@controller ~]# openssl rand -hex 10
2?keystone

yum install openstack-keystone httpd mod_wsgi python-openstackclient memcached python-memcached
3?memcache

# systemctl enable memcached.service
# systemctl start memcached.service
4?

Edit the /etc/keystone/keystone.conf file and complete the following actions:
In the [DEFAULT] section, define the value of the initial administration token:
1
2
3
[DEFAULT]

admin_token = ADMIN_TOKEN
Replace ADMIN_TOKEN with the random value that you generated in a previous step.
In the [database] section, configure database access:
1
2
3
[database]

connection = mysql://keystone:KEYSTONE_DBPASS@controller/keystone
Replace KEYSTONE_DBPASS with the password you chose for the database.
In the [memcache] section, configure the Memcache service:
1
2
3
[memcache]

servers = localhost:11211
In the [token] section, configure the UUID token provider and Memcached driver:
1
2
3
4
[token]

provider = keystone.token.providers.uuid.Provider
driver = keystone.token.persistence.backends.memcache.Token
In the [revoke] section, configure the SQL revocation driver:
1
2
3
[revoke]

driver = keystone.contrib.revoke.backends.sql.Revoke
(Optional) To assist with troubleshooting, enable verbose logging in the [DEFAULT] section:
1
2
3
[DEFAULT]

verbose = True
Populate the Identity service database:
# su -s /bin/sh -c “keystone-manage db_sync” keystone
5?HTTP

Edit the /etc/httpd/conf/httpd.conf file and configure the ServerName option to reference the controller node:
ServerName controller
Create the /etc/httpd/conf.d/wsgi-keystone.conf file with the following content:
Listen 5000
Listen 35357

<VirtualHost *:5000>
WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-public
WSGIScriptAlias / /var/www/cgi-bin/keystone/main
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
LogLevel info
ErrorLogFormat “%{cu}t %M”
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
</VirtualHost>

<VirtualHost *:35357>
WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
WSGIProcessGroup keystone-admin
WSGIScriptAlias / /var/www/cgi-bin/keystone/admin
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
LogLevel info
ErrorLogFormat “%{cu}t %M”
ErrorLog /var/log/httpd/keystone-error.log
CustomLog /var/log/httpd/keystone-access.log combined
</VirtualHost>
Create the directory structure for the WSGI components:
# mkdir -p /var/www/cgi-bin/keystone
Copy the WSGI components from the upstream repository into this directory:
# curl http://git.openstack.org/cgit/openstack/keystone/plain/httpd/keystone.py?h=stable/kilo | tee /var/www/cgi-bin/keystone/main /var/www/cgi-bin/keystone/admin
Adjust ownership and permissions on this directory and the files in it:
# chown -R keystone:keystone /var/www/cgi-bin/keystone
# chmod 755 /var/www/cgi-bin/keystone/*
Restart the Apache HTTP server:
# systemctl enable httpd.service
# systemctl start httpd.service

Page 10 of 163« First...89101112...203040...Last »