06. Replication
Last updated
Last updated
Broker์ ์ฅ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ ํด๋น Broker์ Partition์ ๋ชจ๋ ์ฌ์ฉ ํ ์ ์๊ฒ ๋๋ค. โ Replication์ ํตํ ์ฅ์ ๋๋น
Partition์ ๋ณต์ (Replication)ํ์ฌ ๋ค๋ฅธ Broker ์์์ ๋ณต์ ๋ฌผ(Replicas)๋ฅผ ๋ง๋ค์ด์ ์ฅ์ ๋ฅผ ๋ฏธ๋ฆฌ ๋๋น.
Leader Partition, Follower Partition์ผ๋ก ๊ตฌ์ฑ.
Producer๋ Leader์ Write / Follower๋ Leader๋ก๋ถํฐ Read
Follower๊ฐ Leader์ Commit Log๋ฅผ Fetch Requestํ๋ค.
Apache Kafka 2.4๋ถํฐ Follower Fetching(Read) ๊ฐ๋ฅ
Kafka ํด๋ฌ์คํฐ๋ Follower ์ค์์ ์๋ก์ด Leader ์ ์ถ
Clients(Producer/Consumer)๋ ์๋์ผ๋ก ์ Leader๋ก ์ ํ
ํ๋์ ๋ธ๋ก์ปค์ Partition์ Leader๋ค์ด ๋ชฐ๋ ค ์๋ ๊ฒฝ์ฐ, ํน์ broker์ ๋ถํ ์ง์ค(Hot Spot)
Hot Spot ๋ฐฉ์ง ์ต์
auto.leader.rebalance.enable: ๊ธฐ๋ณธ๊ฐ enable
leader.imbalance.check.interval.seconds: ๊ธฐ๋ณธ๊ฐ 300 sec
leader.imbalance.per.broker.percentage: ๊ธฐ๋ณธ๊ฐ 10%
Rack๊ฐ ๋ถ์ฐํ์ฌ Rack ์ฅ์ ๋ฅผ ๋๋น
๋(Rack)์ PC๋ ์๋ฒ, ํต์ ์ฅ๋น, ๊ฐ์ข ๊ณ์ธก๊ธฐ ๋ฑ ์ผ์ ์์คํ ์ ๊ตฌ์ฑํ๋ ์ฅ๋น๋ค์ ๋ณด๊ดํ๊ณ ์์คํ ๊ตฌ์ฑ์ ํ์ํ ํ๊ฒฝ์ ๋ง๋ค์ด์ฃผ๋ ์ ํ.
๋์ผํ Rack ํน์ Avilable Zone ์์ Broker๋ค์ ๋์ผํ โrack nameโ ์ง์
๋ณต์ ๋ณธ(Replica-Leader/Follower)์ ์ต๋ํ Rack ๊ฐ์ ๊ท ํ์ ์ ์งํ์ฌ Rack ์ฅ์ ๋๋น
Topic ์์ฑ์ ๋๋ Auto Data Balancer/Self Balancing Cluster ๋์ ๋๋ง ์คํ
Rack Awareness๋ฅผ ํ๋ ์ด์ ?
๋ฐ์ดํฐ์ ๋ณต์ฌ๋ณธ๋ค์ด ๋์ผํ ๋์ ์ ์ฅ์ด ๋๋ฉด, ์ค์์น(Switch) ์ฅ๋น์ ๊ณ ์ฅ์ด๋ ์ ์ ์ผ๋ก ์ธํ์ฌ ๋ณต์ ๋ฅผ ํ๋๋ฐ๋ ๋ง์ฐฌ๊ฐ์ง๋ก ์๋น์ค๋ฅผ ๋ฐ์ง ๋ชปํ๊ฒ ๋ ์ ์๋ค.
์ด๋ฌํ ๋ฌธ์ ๋ฅผ ๋ฏธ์ฐ์ ๋ฐฉ์งํ๊ธฐ ์ํด์ ๋ฐ์ดํฐ ๋ณต์ ๋ณธ์ด ํด๋ฌ์คํฐ์ ์ด๋ ์ฅ์์ ์์น์์ผ์ผ ํ๋์ง์ ๋ํ ์ง์ ์ธ ๊ฒฐ์ (Intelligent decision)์ ํด์ผ ํ๋ค.