cluster SQL节点搭建小问题:Could not find ./bin/my_print_defaults

giant7 2014-11-04 03:55:11
本人下载了MySQL cluster 7.3.7 (下载地址:http://dev.mysql.com/downloads/cluster/) 二进制版本。本人参考博客:http://blog.itpub.net/26230597/viewspace-1087713/ 进行安装,目前已经在管理节点和数据节点安装好了Cluster。但是在 SQL节点上安装Cluster就出现了问题


SQL 节点安装步骤如下:

解压文件
shell>tar -zxvf mysql-cluster-gpl-7.3.7-linux-glibc2.5-i686.tar.gz



拷贝安装文件
shell>mv /home/David/cluster/mysql-cluster-gpl-7.3.7-linux2.6-x86_64 /usr/local/mysql


添加mysql用户
shell>groupadd mysql
shell>useradd -g mysql mysql


添加权限
shell>chown -R mysql:mysql /usr/local/mysql


拷贝配置文件
shell>cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf



初始化数据库
shell>cd /usr/local/mysql

shell>scripts/mysql_install_db --user=mysql
报错:
sh: 1: ./bin/my_print_defaults: not found
FATAL ERROR: Neither host 'ubuntu' nor 'localhost' could be looked up with
./bin/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option


本人采用了如下方法来解决:
解决方法1:
查看 /etc/hosts, 其内容如下:
127.0.0.1 localhost
127.0.1.1 ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

127.0.0.1 localhost,localhost.localdomain
172.3.200.159 localhost,localhost.locqaldomain

完全符合网上所说“要添加 127.0.0.1 localhost到/etc/hosts文件中“。最后一行”172.3.200.159“是本人的ip地址。



解决方法2:
修改 ~/.bashrc文件的内容:

vi ~/.bashrc
export PATH=/usr/local/mysql/bin:$PATH
source ~/.bashrc
重新启动机器,重新执行命令:scripts/mysql_install_db --user=mysql
出现了如下错误:
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.

If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.

又参考网页: http://blog.sina.com.cn/s/blog_546cc4350101g1pj.html
执行命令:/usr/local/mysql/scripts/mysql_install_db –user=mysql –basedir=/usr/local/mysql –datadir=/usr/local/mysql/data &

又出现error:
root@ubuntu:/usr/local/mysql/bin# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data &
[1] 2264
root@ubuntu:/usr/local/mysql/bin# sh: 1: /usr/local/mysql/bin/my_print_defaults: not found
FATAL ERROR: Neither host 'ubuntu' nor 'localhost' could be looked up with
/usr/local/mysql/bin/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option


采用以上两种方法,仍然无法解决问题,到底该如何解决了???
请告诉帮忙解答,谢谢!
...全文
1351 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
giant7 2014-11-05
  • 打赏
  • 举报
回复
引用 3 楼 mchdba 的回复:
怀疑你下载的包不对,你看看那篇bloghttp://blog.itpub.net/26230597/viewspace-1087713/上面的下载的包名称: mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz
我刚刚查看了 MySQL官方文档: 《MySQL 5.6 Reference Manual.pdf》 《MySQL 5.5 Reference Manual.pdf》 《MySQL 5.6 Reference Manual.pdf》里面 讲解的是 MySQL CLuster 7.3 《MySQL 5.5 Reference Manual.pdf》里面 讲解的是 MySQL CLuster 7.2 而我用的是 MySQL-5.5.39, Cluster用的是最新版 Cluster-7.3.7, 是不是这个原因导致的? 但是一细想又不对啊。 安装Cluster之前根本就不用先安装MySQL。所以,跟MySQL版本没有任何关系的! 个人感觉应该跟机器和配置文件有关系,请各位高手指教!!!
giant7 2014-11-05
  • 打赏
  • 举报
回复
引用 11 楼 mchdba 的回复:
[quote=引用 10 楼 ggxxkkll 的回复:] [quote=引用 8 楼 mchdba 的回复:] [quote=引用 7 楼 ggxxkkll 的回复:] [quote=引用 6 楼 mchdba 的回复:] 对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分: If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库??? [/quote] 不是的,嘿嘿,我发这个连接是猜测你下载的tar.gz包可能有误。[/quote] [color=#FF0000]为什么就没有人能解决这个问题了? scripts/mysql_install_db --user=mysql scripts/mysql_install_db: 1: scripts/mysql_install_db: ./bin/my_print_defaults: not found Neither host 'ubuntu' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option[/quote] 贴下你的my.cnf配置文件,大家帮看看,这个跟cluster没有关系了,跟mysql的安装启动有关。[/quote] 谢谢你的回复! 我的安装目录下有两个cnf文件,一个是 /usr/local/mysql/support-files/my-default.cnf ,另一个是 /usr/local/mysql/my-new.cnf。按照教程应该是前者(my-default.cnf ),其内容如下: # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... # socket = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
九月茅桃 2014-11-04
  • 打赏
  • 举报
回复
引用 10 楼 ggxxkkll 的回复:
[quote=引用 8 楼 mchdba 的回复:] [quote=引用 7 楼 ggxxkkll 的回复:] [quote=引用 6 楼 mchdba 的回复:] 对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分: If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库??? [/quote] 不是的,嘿嘿,我发这个连接是猜测你下载的tar.gz包可能有误。[/quote] [color=#FF0000]为什么就没有人能解决这个问题了? scripts/mysql_install_db --user=mysql scripts/mysql_install_db: 1: scripts/mysql_install_db: ./bin/my_print_defaults: not found Neither host 'ubuntu' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option[/quote] 贴下你的my.cnf配置文件,大家帮看看,这个跟cluster没有关系了,跟mysql的安装启动有关。
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 8 楼 mchdba 的回复:
[quote=引用 7 楼 ggxxkkll 的回复:] [quote=引用 6 楼 mchdba 的回复:] 对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分: If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库??? [/quote] 不是的,嘿嘿,我发这个连接是猜测你下载的tar.gz包可能有误。[/quote] [color=#FF0000]为什么就没有人能解决这个问题了? scripts/mysql_install_db --user=mysql scripts/mysql_install_db: 1: scripts/mysql_install_db: ./bin/my_print_defaults: not found Neither host 'ubuntu' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --force option
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 8 楼 mchdba 的回复:
[quote=引用 7 楼 ggxxkkll 的回复:] [quote=引用 6 楼 mchdba 的回复:] 对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分:[color=#FF0000] If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库??? [/quote] 不是的,嘿嘿,我发这个连接是猜测你下载的tar.gz包可能有误。[/quote] 你那个包我在 官网 没有找到 7.3.7对应的版本啊。(http://dev.mysql.com/downloads/cluster/) 我不觉得是 包的问题,应该是我系统的某方面的问题。
九月茅桃 2014-11-04
  • 打赏
  • 举报
回复
引用 7 楼 ggxxkkll 的回复:
[quote=引用 6 楼 mchdba 的回复:] 对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分:[color=#FF0000] If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库??? [/quote] 不是的,嘿嘿,我发这个连接是猜测你下载的tar.gz包可能有误。
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 6 楼 mchdba 的回复:
对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分:[color=#FF0000] If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
谢谢你的回复! 还有一个问题你忘记解答我了: 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。 方法三 Start mysqld with su instead of using --user.的意思是 把 scripts/mysql_install_db --user=mysql --user=mysql 改用命令: service mysqld start 来初始化数据库???
九月茅桃 2014-11-04
  • 打赏
  • 举报
回复
对于cluster环境,主机A,主机B,主机C的系统配置最好一模一样。 Ubuntu系统系统没有用过,不好诊断。 ----------------------------------------- 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分:[color=#FF0000] If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? 这里说的是mysql版本。
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 3 楼 mchdba 的回复:
怀疑你下载的包不对,你看看那篇bloghttp://blog.itpub.net/26230597/viewspace-1087713/上面的下载的包名称: mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz
的确包名不对啊。 你的是 mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz 我的是 mysql-cluster-gpl-7.3.7-linux-glibc2.5-i686.tar.gz 从包名看,有2 个区别: 区别1: 一个64位,一个32位 区别2: 你的是 linux2.6, 我的是linux-glibc2.5 你提供的网址:http://wanghuiwl320.blog.163.com/blog/static/21598811201238114833768/ 中的解决方案内容如下; If you are using a libc-based system (instead of a glibc2 system), you will probably get some problems with hostname resolving and getpwnam() with the binary release. (This is because glibc unfortunately depends on some external libraries to resolve hostnames and getpwent() , even when compiled with -static). In this case you probably get the following error message when you run mysql_install_db: Sorry, the host 'xxxx' could not be looked up or the following error when you try to run mysqld with the --user option: getpwnam: No such file or directory You can solve this problem in one of the following ways: 方法一 Get a MySQL source distribution (an RPM or the tar.gz distribution) and install this instead. 我不可能用source版本,因为我在 管理节点,数据节点都是用的 二进制版本。 方法二 Execute mysql_install_db --force; This will not execute the resolveip test in mysql_install_db. The downside is that you can't use host names in the grant tables; you must use IP numbers instead (except for localhost). If you are using an old MySQL release that doesn't support --force, you have to remove the resolveip test in mysql_install with an editor. 这种方法我试过很多次了,都不好用。 方法三 Start mysqld with su instead of using --user. The Linux-Intel binary and RPM releases of MySQL are con gured for the highest possible speed. We are always trying to use the fastest stable compiler available. 这种方法我不太懂。原来 初始化数据库的命令 scripts/mysql_install_db --user=mysql --user=mysql。Start mysqld with su instead of using --user.的意思是 改用命令: service mysqld start 来初始化数据库??? 文字最开始的红色部分:[color=#FF0000] If you are using a libc-based system (instead of a glibc2 system) 是什么意思,是说 ubuntu的系统版本,还是说 MySQL的版本? [/color] 其实,这个问题在这台机器上不是第一次出现了。因为我要搭建mysql集群,所以首先在 三台机器上面都安装上了mysql。不过安装环境有区别: 主机A的环境是:Win7下的VirtualBox + Ubuntu + MySQL, 主机B的环境是:Win7下的VirtualBox + Ubuntu + MySQL, 主机C的环境是:Ubuntu系统 + MySQL。主机C的系统直接在机器上面安装的,不是虚拟环境,安装方法:wubi安装。 最开始在三台主机分别安装MySQL时,主机A和主机B都能顺利安装,但是主机C上面安装有问题,出现的问题跟现在搭建cluster的问题一模一样(详见我发布的帖子: http://www.itpub.net/thread-1894039-1-1.html为什么每次在主机C上面执行 scripts/mysql_install_db --user=mysql, 都会出现这种错误了??? 请教了! 多谢!
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 3 楼 mchdba 的回复:
怀疑你下载的包不对,你看看那篇bloghttp://blog.itpub.net/26230597/viewspace-1087713/上面的下载的包名称: mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz
我下载的是 二进制包,包名是: mysql-cluster-gpl-7.3.7-linux-glibc2.5-i686.tar.gz
九月茅桃 2014-11-04
  • 打赏
  • 举报
回复
怀疑你下载的包不对,你看看那篇bloghttp://blog.itpub.net/26230597/viewspace-1087713/上面的下载的包名称: mysql-cluster-gpl-7.2.4-linux2.6-x86_64.tar.gz
giant7 2014-11-04
  • 打赏
  • 举报
回复
引用 1 楼 mchdba 的回复:
参考:http://wanghuiwl320.blog.163.com/blog/static/21598811201238114833768/
老大,你终于出来了 我就是参考你的博客。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧