Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set security protocol #146

Open
Holy-Shine opened this issue Dec 15, 2022 · 2 comments
Open

how to set security protocol #146

Holy-Shine opened this issue Dec 15, 2022 · 2 comments

Comments

@Holy-Shine
Copy link

How to set security protocol to SASL_PLAINTEXT

@doujiang24
Copy link
Owner

Is the demo in the doc you are wanted?

                local broker_list = {
                    {
                        host = "127.0.0.1",
                        port = 9092,

                        -- optional auth
                        sasl_config = {
                            mechanism = "PLAIN",
                            user = "USERNAME",
                            password = "PASSWORD",
                        },
                    },
                }

https://github.com/doujiang24/lua-resty-kafka#synopsis

@Holy-Shine
Copy link
Author

Actually this is how I did, but I still could not get broker metadata from my kafka server. I debugged the broker.lua and found that the SASL function return an error(in line 99, _sasl_handshake returned OK while _sasl_auth failed)。

When I use Python library kafka-python, I define producer like this:

prod = KakaProducer(
    bootstrap_server=[xxx,xxx],
    security_protocal='SASL_PLAINTEXT',
    sasl_mechanism='PLAIN',
    sasl_plain_username='xxxx',
    sasl_plain_password='xxx'
)

I do not really know how sercuriy_protocal works, but if I do not declare it explicitly, I will not be able to connect to my kafka server correctly.

So I wonder if this is the reason for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants