NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here.
Enter current password for root (enter for none): OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation.
Set root password? [Y/n] Y New password: 123456 Re-enter new password: 123456 Password updated successfully! Reloading privilege tables.. ... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment.
Remove anonymous users? [Y/n] y ... Success!
Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n ... skipping.
By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment.
Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success!
Reloading the privilege tables will ensure that all changes made so far will take effect immediately.
Reload privilege tables now? [Y/n] y ... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB installation should now be secure.
Thanks for using MariaDB!
配置文件修改
此处略有不同。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
[root@xnode2 ~]# vim /etc/my.cnf [mysqld] log_bin=mysql-bin server_id=12
[root@xnode1 ~]# zookeeper-3.4.14/bin/zkServer.sh start ZooKeeper JMX enabled by default Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED # 看似启动了,然鹅······ [root@xnode1 ~]# zookeeper-3.4.14/bin/zkServer.sh status ZooKeeper JMX enabled by default Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg Error contacting service. It is probably not running. # 莫慌,把其他两个启动了就好了
[root@xnode2 ~]# zookeeper-3.4.14/bin/zkServer.sh start ZooKeeper JMX enabled by default Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
[root@xnode3 ~]# zookeeper-3.4.14/bin/zkServer.sh start ZooKeeper JMX enabled by default Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg Starting zookeeper ... STARTED
[root@xnode1 ~]# zookeeper-3.4.14/bin/zkServer.sh status ZooKeeper JMX enabled by default Using config: /root/zookeeper-3.4.14/bin/../conf/zoo.cfg Mode: follower
搭建kafka集群
解压
1 2 3 4 5
[root@xnode1 ~]# for i in xnode2 xnode3;do scp kafka_2.11-1.1.1.tgz $i:/root/;done kafka_2.11-1.1.1.tgz 100% 55MB 81.4MB/s 00:00 kafka_2.11-1.1.1.tgz 100% 55MB 78.8MB/s 00:00
[root@xnode1 ~]# tar xf kafka_2.11-1.1.1.tgz
修改配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14
[root@xnode1 ~]# cd kafka_2.11-1.1.1/config/ broker.id=1 listeners=PLAINTEXT://192.168.1.11:9092 zookeeper.connect=192.168.1.11:2181,192.168.1.12:2181,192.168.1.13:2181
[root@xnode2 ~]# cd kafka_2.11-1.1.1/config/ broker.id=2 listeners=PLAINTEXT://192.168.1.12:9092 zookeeper.connect=192.168.1.11:2181,192.168.1.12:2181,192.168.1.13:2181
[root@xnode3 ~]# cd kafka_2.11-1.1.1/config/ broker.id=3 listeners=PLAINTEXT://192.168.1.13:9092 zookeeper.connect=192.168.1.11:2181,192.168.1.12:2181,192.168.1.13:2181
启动服务
1 2 3 4 5 6 7 8
[root@xnode1 config]# cd .. [root@xnode1 kafka_2.11-1.1.1]# cd bin [root@xnode1 bin]# ./kafka-server-start.sh -daemon ../config/server.properties [root@xnode1 bin]# jps 5069 WrapperSimpleApp 15709 Kafka 15294 QuorumPeerMain 15775 Jps
安装redis服务
在xnode1上安装,并配置启动。
1 2 3 4 5 6 7 8 9 10 11 12
[root@xnode1 ~]# yum install redis -y
[root@xnode1 ~]# vim /etc/redis.conf # bind 127.0.0.1 protected-mode no
[root@xnode1 ~]# vim /etc/nginx/conf.d/default.conf upstream gpuser { server 192.168.1.11:8082; server 192.168.1.12:8082; server 192.168.1.13:8082; ip_hash; }
upstream gpshopping { server 192.168.1.11:8081; server 192.168.1.12:8081; server 192.168.1.13:8081; ip_hash; }
upstream gpcashier { server 192.168.1.11:8083; server 192.168.1.12:8083; server 192.168.1.13:8083; ip_hash; }