๋ฐ˜์‘ํ˜•

read preference 2

[MongoDB] Read Preference ์˜๋ฏธ์™€ ์ข…๋ฅ˜

Intro mongodb์˜ read preference์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Read Preference? read preference๋ž€ mongo db์—์„œ replica set ์„ค์ • ์‹œ primary, secondary์— ๋Œ€ํ•œ ์„ค์ •์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด mongo db๋Š” 5๊ฐ€์ง€ ๋ฐฉ๋ฒ•์„ ์ง€์›ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. Read Preference ModeDescription primary Default mode. All operations read from the current replica set primary. Multi-document transactions that contain read operations must use read preference primary. All operations in a give..

Database/monogodb 2022.11.16

[Springboot] mongodb read preference ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” spring boot ์—์„œ mongodb read preference๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ œ ๊ฒฝ์šฐ Spring boot ๋กœ ๊ตฌ์„ฑ๋œ ํ”„๋กœ์ ํŠธ์— monogo db read preference ๊ฐ€ ๋”ฐ๋กœ ์ ์šฉ๋˜์–ด ์žˆ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ์—ฌ๋Ÿฌ read preference mode ์ค‘์—์„œ secondaryPreferred ๋ฅผ ์ ์šฉํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. Read preference ์ฐธ๊ณ ๋กœ, Read preference๋ž€ MongoDB ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์ฝ๊ธฐ ์ž‘์—…์„ replica set์˜ members์—๊ฒŒ route ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด 5๊ฐ€์ง€์˜ ๋ฐฉ์‹์ด ์žˆ์œผ๋ฉฐ, primary๊ฐ€ ๊ธฐ๋ณธ default ๊ฐ’์œผ๋กœ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. primary (default mode..

๋ฐ˜์‘ํ˜•