mysql8.0 redis mongodb集群部署error集

 

问题1:

2019-03-25T02:10:56.174073Z 0 [ERROR] [MY-010187] [Server] Could not open /data/mysql/log/mysql_err.log file for error logging: Permission denied.

解决方法:chmod 777 mysql_err.log 

 

问题2:

2019-03-25T02:38:03.372691Z mysqld_safe Logging to '/data/mysql/log/mysql_err.log'.
2019-03-25T02:38:03.397704Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/datas
2019-03-25T02:38:03.696354Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.12) starting as process 10753
2019-03-25T02:38:03.706402Z 1 [ERROR] [MY-011011] [Server] Failed to find valid data directory.
2019-03-25T02:38:03.706533Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2019-03-25T02:38:03.706554Z 0 [ERROR] [MY-010119] [Server] Aborting

解决方法:把 /etc/my.cnf 下的 datadir 注释掉

 

问题3:

另外,还有权限问题,查看/data/mysql/log/mysql_err.log,发现

Can't create test file /data/mysql/datas/iZbp1byxu1xm38025t5u6Z.lower-test

这里是因为没有权限创建或读取文件。。

另外一个办法是restorecon -FRv /home/data/mysql

最后一个绝招!重启一下!reboot

 

问题4:

redis

[root@iZbp1byxu1xm38025t5u7Z redis]# ./src/redis-cli -c -h 172.16.7.230 -p 26380
172.16.1.230:26380> config set masterauth passwd123
(error) NOAUTH Authentication required.
172.16.1.230:26380> config set masterauth passwd123
(error) NOAUTH Authentication required.
172.16.1.230:26380> auth passwd123

连接提示:(error) NOAUTH Authentication required. 

解决方法需要先验证密码 : auth password 

 

问题5:

[root@iZbp1byxu1xm38025t5u8Z redis]# ./src/redis-trib.rb info 172.16.7.230:26380
/usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- redis (LoadError)
    from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from ./src/redis-trib.rb:25:in `<main>'

解决方法:gem install redis

 

问题6:

[root@iZbp1byxu1xm38025t5u8Z redis]# ./src/redis-trib.rb info 172.16.7.230:26380
[ERR] Sorry, can't connect to node 172.16.7.230:26380
[root@iZbp1byxu1xm38025t5u8Z redis]# ./src/redis-trib.rb info 172.16.7.233:26380
[ERR] Sorry, can't connect to node 172.16.7.233:26380

解决方法: vi  /usr/local/rvm/gems/ruby-2.3.4/gems/redis-4.1.0/lib/redis/client.rb   修改里面的password密码内容

 

问题7:

2019-03-26T06:16:58.698738Z 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: cb69893a-4f8d-11e9-9cda-00163e094808:1-4 > Group transactions: 100d0787-4f8c-11e9-9a88-00163e0f5c8d:1-4,
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1-5'
2019-03-26T06:16:58.698802Z 0 [ERROR] [MY-011522] [Repl] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'

解决方法:看看my.cnf  里面 server_id内容是否与其他的重复了

 

问题8: 主mysql服务器可以正常运行,节点mysql服务器出现下面错误:

ERROR 3092 (HY000): The server is not configured properly to be an active member of the group. Please see more details on error log.

2019-03-26T08:16:25.938916Z 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: c07407a1-4f8c-11e9-92e8-00163e09630d:1-4 > Group transactions: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1-9'
2019-03-26T08:16:25.938968Z 0 [ERROR] [MY-011522] [Repl] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'
2019-03-26T08:16:54.094860Z 8 [Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Automatically adding IPv4 localhost address to the whitelist. It is mandatory that it is added.'
2019-03-26T08:16:54.095282Z 16 [System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''.
2019-03-26T08:16:56.937170Z 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: c07407a1-4f8c-11e9-92e8-00163e09630d:1-4 > Group transactions: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1-11'
2019-03-26T08:16:56.937232Z 0 [ERROR] [MY-011522] [Repl] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'

看网上很多是根据日志信息将此变量置为:set global group_replication_allow_local_disjoint_gtids_join=ON;但是根据mysql8.0没有此变量,不推荐此方法

解决方法:

节点服务器执行:
mysql> RESET MASTER;   ---------------很重要

# 停止组复制(所有节点执行):
mysql> stop group_replication;
mysql> set global group_replication_single_primary_mode=OFF;
mysql> set global group_replication_enforce_update_everywhere_checks=ON;

# 随便选择某个节点执行
mysql> SET GLOBAL group_replication_bootstrap_group=ON; 
mysql> START GROUP_REPLICATION; 
mysql> SET GLOBAL group_replication_bootstrap_group=OFF;

# 其他节点执行
mysql> START GROUP_REPLICATION; 

# 查看组信息,所有节点的 MEMBER_ROLE 都为 PRIMARY
mysql> SELECT * FROM performance_schema.replication_group_members;

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+--------------+-------------+--------------+-------------+----------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST  | MEMBER_PORT | MEMBER_STATE | MEMBER_ROLE | MEMBER_VERSION |
+---------------------------+--------------------------------------+--------------+-------------+--------------+-------------+----------------+
| group_replication_applier | 100d0787-4f8c-11e9-9a88-00163e0f5c8d | 172.16.16.230 |        3306 | ONLINE       | PRIMARY     | 8.0.12         |
| group_replication_applier | c07407a1-4f8c-11e9-92e8-00163e09630d | 172.16.16.229 |        3306 | ONLINE       | PRIMARY     | 8.0.12         |
| group_replication_applier | d763ae36-4f99-11e9-a1c2-00163e094808 | 172.16.16.232 |        3306 | ONLINE       | PRIMARY     | 8.0.12         |
+---------------------------+--------------------------------------+--------------+-------------+--------------+-------------+----------------+
3 rows in set (0.00 sec)

问题9:

[2019-03-27 16:12:18.481 [http-nio-28031-exec-1] ERROR org.apache.juli.logging.DirectJDKLog.log[181] - Unable to create initial connections of pool.
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

解决方法:spring.datasource.mysql.url 的地址或者端口是否正确

 

问题10  Error: Authentication failed.

> use admin
switched to db admin
> config = {
...  _id : "shard1",
... members : [
... {_id : 0, host : "172.16.16.230:25001" },
... {_id : 1, host : "172.16.16.232:25001" },
... {_id : 2, host : "172.16.16.229:25001" , arbiterOnly: true}]}
{
    "_id" : "shard1",
    "members" : [
        {
            "_id" : 0,
            "host" : "172.16.16.230:25001"
        },
        {
            "_id" : 1,
            "host" : "172.16.16.232:25001"
        },
        {
            "_id" : 2,
            "host" : "172.16.16.229:25001",
            "arbiterOnly" : true
        }
    ]
}
> rs.initiate(config);
{
    "ok" : 0,
    "errmsg" : "This node, 172.16.16.229:25001, with _id 2 is not electable under the new configuration version 1 for replica set shard1",
    "code" : 93,
    "codeName" : "InvalidReplicaSetConfig"
}
> exit;

原因:因为我执行此命令就是在172.16.16.229 服务器,而此服务器设置是: "host" : "172.16.16.229:25001", "arbiterOnly" : true,所以报错了

解决方法:需要换另外其他服务器执行此操作,我换了172.16.16.230上执行以上命令就可以了

 

11.单机的redis集群

[root@lock-service001 redis]# src/redis-trib.rb create --replicas 1 192.168.1.226:26379  192.168.1.226:26380  192.168.1.226:26381  192.168.1.226:26382  192.168.1.226:26383  192.168.1.226:26384
>>> Creating cluster
[ERR] Sorry, can't connect to node 192.168.1.226:26379

解决方法:

可能导致问题的原因

方法1:redis的配置文件,发现,在配置文件中配置bind 127.0.0.1这个地址,修改指定的IP地址,可以同时指定127.0.0.1,这样本机和ip地址都可以访问

   参考:bind 192.168.1.13 127.0.0.1

当通过原因1解决后,发现还是报错,虽然telnet是可以正常连接了,但是还是报上面的错误

方法2:因为在复制集群的时候,原来安装好的Redis是配置了账号密码,必须要每个redis去掉密码后再配置集群,再在集群中配置账号密码

注释掉配置文件中的配置密码位置

#requirepass 123456

方法3:查看redis的log,/data/redis/log/26379/redis_26379.log

10766:M 17 May 15:03:47.866 * Running mode=cluster, port=26379.
10766:M 17 May 15:03:47.866 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
10766:M 17 May 15:03:47.866 # Server initialized
10766:M 17 May 15:03:47.866 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
10766:M 17 May 15:03:47.866 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

解决方法执行: echo 511 > /proc/sys/net/core/somaxconn

 

12.mongodb

[root@platform local]# ./mongodb/bin/mongo --port 27017
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017/
MongoDB server version: 3.6.5
Server has startup warnings: 
2019-05-17T18:04:44.103+0800 I STORAGE  [initandlisten] 
2019-05-17T18:04:44.103+0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-05-17T18:04:44.103+0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] 
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] 
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] 
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-05-17T18:04:44.776+0800 I CONTROL  [initandlisten] 

> use admin
switched to db admin

> use hello
switched to db hello

> db.auth("hellomongo", "hello2019")
Error: Authentication failed.
0
> use admin
switched to db admin


> db.auth("hellomongo", "hello2019")
Error: Authentication failed.

出现这个问题原因是没先添加创建用户,解决方法:

[root@iZuf61q00u1u1gzrtxkmibZ local]# ps -ef | grep mongodb
root     12322 12152  0 14:34 pts/2    00:00:00 grep --color=auto mongodb
root     31508     1  0 10:09 ?        00:00:23 ./mongodb/bin/mongod -f /usr/local/mongodb/conf/config.conf
[root@iZuf61q00u1u1gzrtxkmibZ local]# ./mongodb/bin/mongo --port 27017
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017/
MongoDB server version: 3.6.5
Server has startup warnings: 
2019-03-13T10:09:58.097+0800 I STORAGE  [initandlisten] 
2019-03-13T10:09:58.097+0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-03-13T10:09:58.097+0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-03-13T10:09:59.008+0800 I CONTROL  [initandlisten] 
2019-03-13T10:09:59.008+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-03-13T10:09:59.008+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-03-13T10:09:59.008+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] 
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] 
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] 
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-03-13T10:09:59.009+0800 I CONTROL  [initandlisten] 
> use admin
> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB



> db.system.version.insert({"_id":"authSchema","currentVersion":3})
WriteResult({ "nInserted" : 1 })
> db.system.version.findOne({"_id":"authSchema"})
{ "_id" : "authSchema", "currentVersion" : 3 }
> use admin
switched to db admin
> db.createUser({user:"admin",pwd:"hello123456",roles:[{role:"userAdminAnyDatabase",db:"admin"}]}) 
Successfully added user: {
    "user" : "admin",
    "roles" : [
        {
            "role" : "userAdminAnyDatabase",
            "db" : "admin"
        }
    ]
}


> use hello
switched to db hello


> db.createUser({user:"hellomongo",pwd:"hello2019",roles :[{ role : "readWrite", db : "hello" }]}) 
Successfully added user: {
    "user" : "hellomongo",
    "roles" : [
        {
            "role" : "readWrite",
            "db" : "hello"
        }
    ]
}
> use admin
switched to db admin
> use hello
switched to db hello
> db.auth("hellomongo", "hello2019")
1
> show users;
{
    "_id" : "hello.hellomongo",
    "user" : "hellomongo",
    "db" : "hello",
    "roles" : [
        {
            "role" : "readWrite",
            "db" : "hello"
        }
    ]
}
> show dbs;
admin   0.000GB
config  0.000GB
local   0.000GB
> db.inventory.save( { type: "book", item: "notebook", qty: 40 } )
WriteResult({ "nInserted" : 1 })
> show collections
inventory
> db.student.save({stuid:"10000", name:"mike", age:18})
WriteResult({ "nInserted" : 1 })
> show collections
inventory
student
> db.student.find()
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
> db.student.in
db.student.initializeOrderedBulkOp(    db.student.insert(                     db.student.insertOne(
db.student.initializeUnorderedBulkOp(  db.student.insertMany(
> db.student.insert({stuid:"10001", name:"xiaoli", age:18})
WriteResult({ "nInserted" : 1 })
> db.student.find()
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
{ "_id" : ObjectId("5c88a5f0ed67c92342f1ac1d"), "stuid" : "10001", "name" : "xiaoli", "age" : 18 }
> db.student.insert({stuid:"10002", name:"周杰伦", age:15})
WriteResult({ "nInserted" : 1 })
> db.student.find()
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
{ "_id" : ObjectId("5c88a5f0ed67c92342f1ac1d"), "stuid" : "10001", "name" : "xiaoli", "age" : 18 }
{ "_id" : ObjectId("5c88a790ed67c92342f1ac1e"), "stuid" : "10002", "name" : "周杰伦", "age" : 15 }
> db.student.find({age: {$lt: 16}})
{ "_id" : ObjectId("5c88a790ed67c92342f1ac1e"), "stuid" : "10002", "name" : "周杰伦", "age" : 15 }
> db.userInfo.find({name: /i/}); 
> db.userInfo.find({name: /mike/});
> db.userInfo.find({name: {regex:/i/}});
> db.userInfo.find({name: {$regex:/i/}});
> db.student.find({name: {$regex:/i/}});
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
{ "_id" : ObjectId("5c88a5f0ed67c92342f1ac1d"), "stuid" : "10001", "name" : "xiaoli", "age" : 18 }
> db.student.find({name: {/i/}});
2019-03-13T14:54:47.898+0800 E QUERY    [thread1] SyntaxError: invalid property id @(shell):1:24
> db.student.find({name: /i/});
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
{ "_id" : ObjectId("5c88a5f0ed67c92342f1ac1d"), "stuid" : "10001", "name" : "xiaoli", "age" : 18 }
> db.getCollection('student').find({name: /i/})
{ "_id" : ObjectId("5c88a599ed67c92342f1ac1c"), "stuid" : "10000", "name" : "mike", "age" : 18 }
{ "_id" : ObjectId("5c88a5f0ed67c92342f1ac1d"), "stuid" : "10001", "name" : "xiaoli", "age" : 18 }
> eixt
2019-03-13T17:50:11.935+0800 E QUERY    [thread1] ReferenceError: eixt is not defined :
@(shell):1:1
> exit

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值