MySQL Too many connections Error

LΒ·2022λ…„ 9μ›” 29일
0
post-thumbnail

λ…μž λŒ€μƒπŸ“£

πŸ‘‰ Apache Hive의 Metastore둜 MySQL을 μ‚¬μš©ν•˜μ‹œλŠ” λΆ„
πŸ‘‰ MySQL μ„œλΉ„μŠ€ μž¬μ‹œμž‘ν•΄λ„ 였λ₯˜κ°€ ν•΄κ²°λ˜μ§€ μ•ŠλŠ” λΆ„
πŸ‘‰ Ubuntu ν™˜κ²½μ—μ„œ κ΅¬μΆ•ν•˜μ‹œλŠ” λΆ„


μΆœκ°„ μ΄μœ β“

MySQL의 Too many connections 였λ₯˜κ°€ ν•΄κ²°λ˜μ§€ μ•ŠλŠ” ν˜„μƒ 발견


문제 νŒŒμ•…πŸ”

...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection,  message from server: "Too many connections"
...
Q: μ•„... my.cnfνŒŒμΌμ„ 아무리 μˆ˜μ •ν•΄λ„ μœ„μ— 였λ₯˜κ°€ 자꾸 λ‚˜μ˜€λ„€μš”..πŸ˜₯
   μ•„λ‹ˆ... μ‹€μˆ˜λ‘œ μ½”λ”©ν•  λ•Œ, 컀λ„₯μ…˜ μ•ˆ 닫은 μ œκ°€ 잘λͺ»ν•œκ±΄ λ§žλŠ”λ°,
   κ·Έλ ‡λ‹€κ³  μ΄λ ‡κ²ŒκΉŒμ§€ ν•΄κ²° μ•ˆ 될 λ¬Έμ œμΈκ°€μš”πŸ˜«

문제 ν•΄κ²°πŸŽŠ

A: γ…‹γ…‹γ…‹ μ§„μ •ν•˜μ‹œκ³ ~
   μ•„λž˜μ˜ μˆœμ„œλ₯Ό λ”°λΌμ„œ 문제 ν•΄κ²° κ°€μ¦ˆμ•„~~✈✈

   ν•˜λ‹¨μ˜ λ‚΄μš©μ„ μ°Έκ³ ν•˜μ—¬ 이 Disgustingν•œ 문제λ₯Ό ν•΄κ²°ν•˜μ‹­μ‹œμ˜€β—β—
  1. service mysql restart

    $ service mysql restart
    * Stopping MySQL database server mysqld     [fail]
    * Starting MySQL database server mysqld     [ OK ]
    
    # μƒλ‹¨μ²˜λŸΌ "[fail]"이 뜨면 μˆ˜μ •ν•œ my.cnf 파일이 μ œλŒ€λ‘œ λ°˜μ˜λ˜μ§€ μ•Šμ€ 것❗❗
    # MySQL 버전을 ν™•μΈν•˜κ³ , ν•΄λ‹Ή λ²„μ „μ—μ„œ μ‚¬μš©ν•  수 μ—†λŠ”
    # key-val μ„ΈνŠΈλ₯Ό μ‚¬μš©ν–ˆλŠ”μ§€ λ‹€μ‹œ ν•œ 번 ν™•μΈν•˜κ³  λ‹€μŒ λ‹¨κ³„λ‘œ 고고❗
  2. MySQL ν”„λ‘œμ„ΈμŠ€ κ°•μ œ μ’…λ£Œ

    $ ps aux | grep mysql | grep -v grep
    # μƒλ‹¨μ˜ μ»€λ§¨λ“œ μ‹€ν–‰ κ²°κ³Ό, "/usr/sbin/mysqld --basedir~" 이라고 λœ¨λŠ”
    # ν”„λ‘œμ„ΈμŠ€ 번호 μ°Ύμ•„μ„œ κ°•μ œ μ’…λ£Œβ—β—
    
    $ kill -9 [mysqld pid]
  3. service mysql start

    $ service mysql start
    * Starting MySQL database server mysqld     [ OK ]
    # 일단 MySQL μ„œλΉ„μŠ€λ₯Ό κ°•μ œ μ’…λ£Œν•œ ν›„, μž¬μ‹œμž‘μ΄ 됨
  4. Apache Hive 접속

    # hive
    SLF4J: Class path contains multiple SLF4J bindings. 
    SLF4J: Found binding in [jar:file:/opt/hive/lib/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
    SLF4J: Found binding in [jar:file:/opt/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.30.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
    SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 
    Hive Session ID = ac4dd78d-818c-4033-8fef-51c1594d63dc 
    
    Logging initialized using configuration in jar:file:/opt/hive/lib/hive-common-3.1.2.jar!/hive-log4j2.properties Async: true 
    Hive Session ID = 5a25d539-0a84-4658-bb5d-ec719c9f7187 
    hive>
    
    # 였 μ§€μ €μŠ€ 크라이슀트 μˆ˜νΌμŠ€νƒ€ ν•΄κ²°μ™„λ£ŒπŸŽ‰πŸŽ†πŸŽ‡πŸŽŠ
profile
데이터 μš”λ¦¬μ‚¬

0개의 λŒ“κΈ€