记录 MongoDB 3.0.5 创建基于key认证时出现的一个问题。
1. openssl 版本
openssl version OpenSSL 1.0.1e-fips 11 Feb 2013
2.创建key文件
openssl rand -base64 755 > keyFile.key
chmod 400 keyFile.key
3.启动MongoDB错误
invalid char in key file /data/conf/keyFile.key: =
4.检查keyFile.key
发现key文件的末尾有'='
0QnaedsVXHmyYmPZgiNwvOgIV+Nf6jWD8PJtbAgQnRC8ZdPXB62Qb9trn4VXCUsRzMETMjq+NpjliAYmraKSi+9p3pxfTOFHfisoCP5sx+6j7FbaLCLk6uy3H4p/UAud7Qa1zZLMpdE/KzdBzkQjnV05KUpW09MXUBGzzxxGynZK6mCAC+KFqp5NuomGbexSHtxXDM2kTLz+dHFH/+7093qELHYB+JAVybAFjzfD2s5Em9FMEOlaYhxfY+jNfh16pib9B+mbBMIrSjNpdq6X4HdrwUKtjuJ7Z9e4ZWxSR0g1REeZfG7JYBFSj1tsbT8xP3PoD4nk81bUWMj24wMilajZp9BmM99zjbAN/ieKRGnFYZmYCOqzNtG+wksLUUZmXTA5SnUe1GNQQDXem3289FSWt+F+3//WSdsvL/kqlOe9jm2SrRZ7kSYfFOSyRYNLvHoCc8PIMRxVmlPS9loqNF0xOOdt40xfpV7REl64TvEIOBFkAHpg8nphp5e9YECt21NXYCLmPiePdVdjPZWJQu1vWHPJwiznMb7+QkP6GuwPOCFzFHUoeu/w1qE6rL2IEexwt3ksD1+enTrq7AWn6ZtnQM+OHthllcuXdzYkz+Crwr3rKvB8qnOAlyOt7tD4L6N5LWQaU9L3rVQH2ei2Y/MsTsyIhaLHPvOlRNhnscPN63jq/KHoBvpW8sahnH9f6ye4T1cylInjwoZ7RUUcZxezfK/CkDIU9iS2Rho4avVDwhoDoBFEx0S37zg1gx1NoO0rrJfknYfFFLn2adsyAcbZfx5YCafzxp8XBWj7H7KqwQTR93j0vjpbjycJ0cWvxC1dnNVg7V+UJrgVR2fHwtO1pKJg6u9h8IcHKzMKajP6/WnNfuhJI9nBuupXxt43O8F/bexndq1bwTfAud8P316h8/JfBO1R4HzdoZvO8YzOS0s7XOXrU6NYQ2a5pZTZE2yw12RJHg348opq226K6bN6ZsdWUVImr/wMHVSmGzev8dY=
5.解决
去掉key文件末尾的‘=’后,MongoDB启动正常.
估计与openssl与mongodb的版本有关系,之前并未出现此问题。
新闻热点
疑难解答