2016-08-06 3 views
1

mysql에 연결하고 sqoop를 통해 mysql을 가져 오려고합니다.Sqoop 가져 오기 mysql 오류 - 통신 링크 오류

그러나 통신 링크 오류 오류가 발생합니다.

다음은 구성 파일입니다.

[mysqld] 
datadir=/var/lib/mysql 
socket=/var/lib/mysql/mysql.sock 
user=mysql 
symbolic-links=0 

[mysqld_safe] 
log-error=/var/log/mysqld.log 
pid-file=/var/run/mysqld/mysqld.pid 

b) mysql이 정상적으로 실행 중입니다.

60806 12:33:42 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
160806 12:33:43 InnoDB: Initializing buffer pool, size = 8.0M 
160806 12:33:43 InnoDB: Completed initialization of buffer pool 
InnoDB: The first specified data file ./ibdata1 did not exist: 
InnoDB: a new database to be created! 
160806 12:33:43 InnoDB: Setting file ./ibdata1 size to 10 MB 
InnoDB: Database physically writes the file full: wait... 
160806 12:33:44 InnoDB: Log file ./ib_logfile0 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile0 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
160806 12:33:44 InnoDB: Log file ./ib_logfile1 did not exist: new to be created 
InnoDB: Setting log file ./ib_logfile1 size to 5 MB 
InnoDB: Database physically writes the file full: wait... 
InnoDB: Doublewrite buffer not found: creating new 
InnoDB: Doublewrite buffer created 
InnoDB: Creating foreign key constraint system tables 
InnoDB: Foreign key constraint system tables created 
160806 12:33:45 InnoDB: Started; log sequence number 0 0 
160806 12:33:45 [Note] Event Scheduler: Loaded 0 events 
160806 12:33:45 [Note] /usr/libexec/mysqld: ready for connections. 
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution 
160806 23:05:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 
160806 23:05:06 InnoDB: Initializing buffer pool, size = 8.0M 
160806 23:05:06 InnoDB: Completed initialization of buffer pool 
InnoDB: The log sequence number in ibdata files does not match 
InnoDB: the log sequence number in the ib_logfiles! 
160806 23:05:06 InnoDB: Database was not shut down normally! 
InnoDB: Starting crash recovery. 
InnoDB: Reading tablespace information from the .ibd files... 
InnoDB: Restoring possible half-written data pages from the doublewrite 
InnoDB: buffer... 
160806 23:05:07 InnoDB: Started; log sequence number 0 44233 
160806 23:05:07 [Note] Event Scheduler: Loaded 0 events 
160806 23:05:07 [Note] /usr/libexec/mysqld: ready for connections. 
Version: '5.1.73' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution 

업데이트 : 내가 만든 Edureka 데이터베이스와 생성 Employee 테이블

[[email protected] edureka]# sqoop import --connect jdbc:mysql://192.168.56.1/Edureka --table Employee --username root -P --target-dir /sqoopOut1 -m 1; 

Warning: /usr/lib/hcatalog does not exist! HCatalog jobs will fail. 
Please set $HCAT_HOME to the root of your HCatalog installation. 
Enter password: 
16/08/06 23:34:48 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset. 
16/08/06 23:34:48 INFO tool.CodeGenTool: Beginning code generation 
16/08/06 23:34:48 ERROR manager.SqlManager: Error executing statement: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 

여기에 내 로그 파일입니다.

[[email protected] edureka]# mysql -u root -p 

는 암호를 입력 : 오신 것을 환영합니다 MySQL의 모니터에. 명령은 다음으로 끝납니다. 또는 \ g. MySQL 연결 ID는 3입니다. 서버 버전 : 5.1.73 소스 배포판

저작권 (c) 2000, 2013, Oracle 및/또는 그 계열사. 판권 소유.

오라클은 Oracle Corporation 및/또는 해당 기업의 계열사의 등록 상표입니다. 다른 이름은 해당 소유자의 상표 일 수 있습니다.

'help;'유형 또는 '\ h'를 입력하십시오. '\ c'를 입력하여 현재 입력 명령문을 지우십시오.

MySQL은>이 어떻게

mysql> select * from employee; 
+--------+-------+ 
| ename | ecode | 
+--------+-------+ 
| neha | 101 | 
| yogesh | 102 | 
+--------+-------+ 
2 rows in set (0.00 sec) 

-A

데이터베이스와 빠른 시작을 얻기 위해이 기능을 해제 할 수 있습니다 테이블 및 열 이름의 완성 edureka 독서 테이블 정보를 사용하여 변경 내 SQL에 같은 '쇼 보조금'보기 : 당신이에 포트 번호를 사용한다

mysql> show grants; 
+----------------------------------------------------------------------------------------------------------------------------------------+ 
| Grants for [email protected]                            | 
+----------------------------------------------------------------------------------------------------------------------------------------+ 
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION | 
+----------------------------------------------------------------------------------------------------------------------------------------+ 
1 row in set (0.00 sec) 

답변

2

0 연결 문자열 :

sqoop import --connect jdbc:mysql://192.168.56.1:3306/Edureka --table Employee --username root -P --target-dir /sqoopOut1 -m 1; 

더 많은 경우 IP 대신 호스트 이름을 사용해야합니다.

sqoop import --connect jdbc:mysql://computer.name:3306/Edureka --table Employee --username root -P --target-dir /sqoopOut1 -m 1; 
+0

로컬 호스트 사용에 : 위의 Sqoop을 가져 오기에 3306
그렇게 명령 hostname -f의 출력은 JDBC 연결 문자열에 computer.name 사용이됩니다. Edureka 데이터베이스가 존재하지 않는다는 오류가 발생합니다. 그러나, 나는 데이터베이스를 만들었습니다 – Powershel

+0

당신은 MySQL 측에서 데이터베이스가 존재하는지 확인할 수 있습니까? –

+0

예, 위의 UPDATE에 추가했습니다. MySQL 데이터베이스가 존재합니다. – Powershel

관련 문제